Responsive Facebook Page Plugin - Version 1.2.3

Version Description

  • Fixed bug where the admin dashboard and widgets pages would break if the WordPress installation is running on localhost and there is no internet connection
Download this release

Release Info

Developer cameronjonesweb
Plugin Icon 128x128 Responsive Facebook Page Plugin
Version 1.2.3
Comparing to
See all releases

Code changes from version 1.2.2 to 1.2.3

Files changed (2) hide show
  1. facebook-page-feed-graph-api.php +55 -12
  2. readme.txt +13 -3
facebook-page-feed-graph-api.php CHANGED
@@ -1,9 +1,9 @@
1
  <?php
2
  /**
3
- * Plugin Name: Facebook Page Feed (Graph API)
4
  * Plugin URI: https://cameronjones.x10.mx/projects/facebook-page-plugin
5
  * Description: Display the Facebook Page Plugin from the Graph API using a shortcode or widget. Now available in 136 different languages
6
- * Version: 1.2.2
7
  * Author: Cameron Jones
8
  * Author URI: http://cameronjones.x10.mx
9
  * License: GPLv2
@@ -28,6 +28,8 @@ add_filter( 'widget_text', 'do_shortcode' );
28
  add_action( 'wp_dashboard_setup', 'facebook_page_plugin_dashboard_widget' );
29
  add_action( 'admin_enqueue_scripts', 'facebook_page_plugin_admin_resources' );
30
  add_action( 'widgets_init', 'facebook_page_plugin_load_widget' );
 
 
31
 
32
  function facebook_page_plugin( $filter ) {
33
  $return = NULL;
@@ -42,8 +44,8 @@ function facebook_page_plugin( $filter ) {
42
  ), $filter );
43
  if(isset($a['href']) && !empty($a['href'])){
44
  $a['language'] = str_replace("-", "_", $a['language']);
45
- $return .= '<div id="fb-root" data-version="1.2.2"></div><script>(function(d, s, id) {var js, fjs = d.getElementsByTagName(s)[0];if (d.getElementById(id)) return;js = d.createElement(s); js.id = id;js.src = "//connect.facebook.net/' . $a['language'] . '/sdk.js#xfbml=1&appId=191521884244670&version=v2.3";fjs.parentNode.insertBefore(js, fjs); }(document, \'script\', \'facebook-jssdk\'));</script>';
46
- $return .= '<div class="fb-page" data-version="1.2.2" data-href="https://facebook.com/' . $a["href"] . '" ';
47
  if(isset($a['width']) && !empty($a['width'])){
48
  $return .= ' data-width="' . $a['width'] . '"';
49
  }
@@ -77,8 +79,16 @@ function facebook_page_plugin_dashboard_widget() {
77
  }
78
 
79
  function facebook_page_plugin_dashboard_widget_callback() {
80
- $lang_xml = file_get_contents('https://www.facebook.com/translations/FacebookLocales.xml');
81
- $langs = new SimpleXMLElement($lang_xml);
 
 
 
 
 
 
 
 
82
  echo '<form>';
83
  echo '<p><label>Facebook Page URL: <input type="url" id="fbpp-href" /></label></p>';
84
  echo '<p><label>Width (pixels): <input type="number" max="500" min="280" id="fbpp-width" /></label></p>';
@@ -87,8 +97,10 @@ function facebook_page_plugin_dashboard_widget_callback() {
87
  echo '<p><label>Show Facepile: <input type="checkbox" value="true" id="fbpp-facepile" /></label></p>';
88
  echo '<p><label>Show Posts Feed: <input type="checkbox" value="true" id="fbpp-posts" /></label></p>';
89
  echo '<p><label>Language: <select id="fbpp-lang" /><option value="">Site Language</option>';
90
- foreach($langs as $lang){
91
- echo '<option value="' . $lang->codes->code->standard->representation . '">' . $lang->englishName . '</option>';
 
 
92
  }
93
  echo '</label></p>';
94
  echo '<input type="text" readonly="readonly" id="facebook-page-plugin-shortcode-generator-output" onfocus="this.select()" />';
@@ -217,8 +229,16 @@ class facebook_page_plugin_widget extends WP_Widget {
217
  } else {
218
  $language = '';
219
  }
220
- $lang_xml = file_get_contents('https://www.facebook.com/translations/FacebookLocales.xml');
221
- $langs = new SimpleXMLElement($lang_xml);
 
 
 
 
 
 
 
 
222
  echo '<p>';
223
  echo '<label for="' . $this->get_field_id( 'title' ) . '">';
224
  echo _e( 'Title:' );
@@ -267,8 +287,10 @@ class facebook_page_plugin_widget extends WP_Widget {
267
  echo '</label>';
268
  echo '<select class="widefat" id="' . $this->get_field_id( 'language' ) . '" name="' . $this->get_field_name( 'language' ) . '">';
269
  echo '<option value="">Site Lanugage (default)</option>';
270
- foreach($langs as $lang){
271
- echo '<option value="' . $lang->codes->code->standard->representation . '"' . selected( esc_attr( $language ), $lang->codes->code->standard->representation, false ) . '>' . $lang->englishName . '</option>';
 
 
272
  }
273
  echo '</select>';
274
  echo '</p>';
@@ -293,3 +315,24 @@ class facebook_page_plugin_widget extends WP_Widget {
293
  function facebook_page_plugin_load_widget() {
294
  register_widget( 'facebook_page_plugin_widget' );
295
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  <?php
2
  /**
3
+ * Plugin Name: Facebook Page Plugin
4
  * Plugin URI: https://cameronjones.x10.mx/projects/facebook-page-plugin
5
  * Description: Display the Facebook Page Plugin from the Graph API using a shortcode or widget. Now available in 136 different languages
6
+ * Version: 1.2.3
7
  * Author: Cameron Jones
8
  * Author URI: http://cameronjones.x10.mx
9
  * License: GPLv2
28
  add_action( 'wp_dashboard_setup', 'facebook_page_plugin_dashboard_widget' );
29
  add_action( 'admin_enqueue_scripts', 'facebook_page_plugin_admin_resources' );
30
  add_action( 'widgets_init', 'facebook_page_plugin_load_widget' );
31
+ add_action( 'admin_notices', 'facebook_page_plugin_admin_notice' );
32
+ add_action( 'admin_init', 'facebook_page_plugin_admin_notice_ignore' );
33
 
34
  function facebook_page_plugin( $filter ) {
35
  $return = NULL;
44
  ), $filter );
45
  if(isset($a['href']) && !empty($a['href'])){
46
  $a['language'] = str_replace("-", "_", $a['language']);
47
+ $return .= '<div id="fb-root" data-version="1.2.3"></div><script async>(function(d, s, id) {var js, fjs = d.getElementsByTagName(s)[0];if (d.getElementById(id)) return;js = d.createElement(s); js.id = id;js.src = "//connect.facebook.net/' . $a['language'] . '/sdk.js#xfbml=1&appId=191521884244670&version=v2.3";fjs.parentNode.insertBefore(js, fjs); }(document, \'script\', \'facebook-jssdk\'));</script>';
48
+ $return .= '<div class="fb-page" data-version="1.2.3" data-href="https://facebook.com/' . $a["href"] . '" ';
49
  if(isset($a['width']) && !empty($a['width'])){
50
  $return .= ' data-width="' . $a['width'] . '"';
51
  }
79
  }
80
 
81
  function facebook_page_plugin_dashboard_widget_callback() {
82
+ try {
83
+ $lang_xml = file_get_contents('https://www.facebook.com/translations/FacebookLocales.xml');
84
+ }catch(Exception $ex){
85
+ $lang_xml = NULL;
86
+ }
87
+ if(isset($lang_xml) && !empty($lang_xml)){
88
+ $langs = new SimpleXMLElement($lang_xml);
89
+ } else {
90
+ $langs = NULL;
91
+ }
92
  echo '<form>';
93
  echo '<p><label>Facebook Page URL: <input type="url" id="fbpp-href" /></label></p>';
94
  echo '<p><label>Width (pixels): <input type="number" max="500" min="280" id="fbpp-width" /></label></p>';
97
  echo '<p><label>Show Facepile: <input type="checkbox" value="true" id="fbpp-facepile" /></label></p>';
98
  echo '<p><label>Show Posts Feed: <input type="checkbox" value="true" id="fbpp-posts" /></label></p>';
99
  echo '<p><label>Language: <select id="fbpp-lang" /><option value="">Site Language</option>';
100
+ if(isset($langs) && !empty($langs)){
101
+ foreach($langs as $lang){
102
+ echo '<option value="' . $lang->codes->code->standard->representation . '">' . $lang->englishName . '</option>';
103
+ }
104
  }
105
  echo '</label></p>';
106
  echo '<input type="text" readonly="readonly" id="facebook-page-plugin-shortcode-generator-output" onfocus="this.select()" />';
229
  } else {
230
  $language = '';
231
  }
232
+ try {
233
+ $lang_xml = file_get_contents('https://www.facebook.com/translations/FacebookLocales.xml');
234
+ }catch(Exception $ex){
235
+ $lang_xml = NULL;
236
+ }
237
+ if(isset($lang_xml) && !empty($lang_xml)){
238
+ $langs = new SimpleXMLElement($lang_xml);
239
+ } else {
240
+ $langs = NULL;
241
+ }
242
  echo '<p>';
243
  echo '<label for="' . $this->get_field_id( 'title' ) . '">';
244
  echo _e( 'Title:' );
287
  echo '</label>';
288
  echo '<select class="widefat" id="' . $this->get_field_id( 'language' ) . '" name="' . $this->get_field_name( 'language' ) . '">';
289
  echo '<option value="">Site Lanugage (default)</option>';
290
+ if(isset($langs) && !empty($langs)){
291
+ foreach($langs as $lang){
292
+ echo '<option value="' . $lang->codes->code->standard->representation . '"' . selected( esc_attr( $language ), $lang->codes->code->standard->representation, false ) . '>' . $lang->englishName . '</option>';
293
+ }
294
  }
295
  echo '</select>';
296
  echo '</p>';
315
  function facebook_page_plugin_load_widget() {
316
  register_widget( 'facebook_page_plugin_widget' );
317
  }
318
+
319
+ function facebook_page_plugin_admin_notice() {
320
+ $screen = get_current_screen();
321
+ //Only display on the dashboard, widgets and plugins pages
322
+ if( $screen->base === 'widgets' || $screen->base === 'dashboard' || $screen->base === 'plugins' ){
323
+ global $current_user ;
324
+ $user_id = $current_user->ID;
325
+ if ( !get_user_meta( $user_id, 'facebook_page_plugin_admin_notice_ignore' ) || get_user_meta( $user_id, 'facebook_page_plugin_admin_notice_ignore' ) === false ) {
326
+ echo '<div class="updated"><p>Thank you for using the Facebook Page Plugin. If you enjoy using it, please take the time to <a href="https://wordpress.org/support/view/plugin-reviews/facebook-page-feed-graph-api?rate=5#postform" target="_blank">leave a review</a>. Thanks. <a href="?facebook_page_plugin_admin_notice_ignore=0" style="float:right;"><b>X</b></a></p></div>';
327
+ }
328
+ }
329
+
330
+ }
331
+
332
+ function facebook_page_plugin_admin_notice_ignore() {
333
+ global $current_user;
334
+ $user_id = $current_user->ID;
335
+ if ( isset($_GET['facebook_page_plugin_admin_notice_ignore']) && '0' == $_GET['facebook_page_plugin_admin_notice_ignore'] ) {
336
+ update_user_meta($user_id, 'facebook_page_plugin_admin_notice_ignore', 'true', true);
337
+ }
338
+ }
readme.txt CHANGED
@@ -1,20 +1,26 @@
1
  === Facebook Page Plugin ===
2
  Contributors: cameronjonesweb
3
- Tags: facebook,social,like,facepile,activity feed,recommendations,shortcode,widget,shortcode generator,plugin,admin,sidebar,facebook page,multilingual
4
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=WLV5HPHSPM2BG&lc=AU&item_name=Cameron%20Jones%20Web%20Development�cy_code=AUD&bn=PP%2dDonationsBF%3abtn_donateCC_LG%2egif%3aNonHosted
5
  Requires at least: 4.0
6
  Tested up to: 4.2.2
7
- Stable tag: 1.2.2
8
  License: GPLv2
9
  License URI: http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
10
 
11
- Display the Facebook Page Plugin from the Graph API using a shortcode or widget. Now available in 136 different languages
12
 
13
  == Description ==
14
  Facebook are depreciating many of their old social plugins on June 23rd 2015, including Activity Feed, Facepile, Like Box and Recommendations. As such, many WordPress plugins that utilise these social plugins will soon stop working. This plugin instead uses the Graph API v2.3 to guarantee your WordPress site continues to have full Facebook support.
15
 
16
  This plugin can be used by added the widget to a widget area and filling out the form, or by using the `[facebook-page-plugin]` shortcode to display the plugin wherever you like, as often as you like.
17
 
 
 
 
 
 
 
18
  If you like the plugin, please take the time to leave a review.
19
 
20
  == Installation ==
@@ -76,6 +82,8 @@ Shortcodes were introduced in WordPress 2.5, so theorectially it should work on
76
  3. The new shortcode generator dashboard widget
77
 
78
  == Changelog ==
 
 
79
  = 1.2.2 =
80
  * Fixed posts option for widget
81
  = 1.2.1 =
@@ -96,6 +104,8 @@ Shortcodes were introduced in WordPress 2.5, so theorectially it should work on
96
  * Initial release
97
 
98
  == Upgrade Notice ==
 
 
99
  = 1.2.2 =
100
  This version addresses a fix for the posts option not working in the widget. Please update immediately.
101
  = 1.2.0 =
1
  === Facebook Page Plugin ===
2
  Contributors: cameronjonesweb
3
+ Tags: facebook,social,like,facepile,activity feed,recommendations,shortcode,widget,shortcode generator,plugin,admin,sidebar,facebook page,multilingual,like box,facebook like box
4
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=WLV5HPHSPM2BG&lc=AU&item_name=Cameron%20Jones%20Web%20Development�cy_code=AUD&bn=PP%2dDonationsBF%3abtn_donateCC_LG%2egif%3aNonHosted
5
  Requires at least: 4.0
6
  Tested up to: 4.2.2
7
+ Stable tag: 1.2.3
8
  License: GPLv2
9
  License URI: http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
10
 
11
+ It's time to upgrade from your old like box! Display the Facebook Page Plugin from the Graph API using a shortcode or widget. Now available in 136 different languages
12
 
13
  == Description ==
14
  Facebook are depreciating many of their old social plugins on June 23rd 2015, including Activity Feed, Facepile, Like Box and Recommendations. As such, many WordPress plugins that utilise these social plugins will soon stop working. This plugin instead uses the Graph API v2.3 to guarantee your WordPress site continues to have full Facebook support.
15
 
16
  This plugin can be used by added the widget to a widget area and filling out the form, or by using the `[facebook-page-plugin]` shortcode to display the plugin wherever you like, as often as you like.
17
 
18
+ Features:
19
+ * Add your Facebook page to any widget area with the custom Facebook Page Plugin widget
20
+ * Add your Facebook page to any page content or text widget area using the shortcode
21
+ * Includes a shortcode generator on the admin dashboard for easy generating of the shortcode
22
+ * Uses your site language by default, but you can display your Facebook page in all 136 languages that Facebook supports
23
+
24
  If you like the plugin, please take the time to leave a review.
25
 
26
  == Installation ==
82
  3. The new shortcode generator dashboard widget
83
 
84
  == Changelog ==
85
+ = 1.2.3 =
86
+ * Fixed bug where the admin dashboard and widgets pages would break if the WordPress installation is running on localhost and there is no internet connection
87
  = 1.2.2 =
88
  * Fixed posts option for widget
89
  = 1.2.1 =
104
  * Initial release
105
 
106
  == Upgrade Notice ==
107
+ = 1.2.3 =
108
+ This version fixes a bug where the admin dashboard and widgets pages would break if the WordPress installation is running on localhost and there is no internet connection. While not imperative to most sites it is recommeded that you update if you work on a localhost or virtual machine
109
  = 1.2.2 =
110
  This version addresses a fix for the posts option not working in the widget. Please update immediately.
111
  = 1.2.0 =