Responsive Facebook Page Plugin - Version 1.7.3

Version Description

  • 14/05/20 =
  • Fixed Immediately Invoked Function Expression that was breaking on PHP < 7.0
  • Code quality improvements in shortcode render method
Download this release

Release Info

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

Code changes from version 1.7.2 to 1.7.3

Files changed (3) hide show
  1. facebook-page-feed-graph-api.php +96 -62
  2. readme.md +5 -1
  3. readme.txt +7 -5
facebook-page-feed-graph-api.php CHANGED
@@ -3,7 +3,7 @@
3
  * Plugin Name: Mongoose Page Plugin
4
  * Plugin URI: https://mongoosemarketplace.com/downloads/facebook-page-plugin/
5
  * Description: The most popular way to display the Facebook Page Plugin on your WordPress website. Easy implementation using a shortcode or widget. Now available in 95 different languages
6
- * Version: 1.7.2
7
  * Author: Mongoose Marketplace
8
  * Author URI: https://mongoosemarketplace.com/
9
  * License: GPLv2
@@ -32,7 +32,7 @@ class cameronjonesweb_facebook_page_plugin {
32
  define( 'CJW_FBPP_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
33
  define( 'CJW_FBPP_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
34
  define( 'CJW_FBPP_PLUGIN_BASENAME', plugin_basename( __FILE__ ) );
35
- define( 'CJW_FBPP_PLUGIN_VER', '1.7.2' );
36
  define( 'CJW_FBPP_PLUGIN_DONATE_LINK', 'https://www.patreon.com/cameronjonesweb' );
37
  define( 'CJW_FBPP_PLUGIN_SURVEY_LINK', 'https://cameronjonesweb.typeform.com/to/BllbYm' );
38
 
@@ -196,85 +196,119 @@ class cameronjonesweb_facebook_page_plugin {
196
  return substr( str_shuffle( str_repeat( implode( '', array_merge( range( 'A', 'Z' ), range( 'a', 'z' ) ) ), 5 ) ), 0, 15 );
197
  }
198
 
199
- // Parse shortcode.
200
- function facebook_page_plugin( $filter ) {
201
- wp_enqueue_script( 'facebook-page-plugin-sdk', CJW_FBPP_PLUGIN_URL . 'js/sdk.js', array(), NULL, true );
202
- wp_enqueue_script( 'facebook-page-plugin-responsive-script', CJW_FBPP_PLUGIN_URL . 'js/responsive.min.js', 'jquery', NULL, true );
203
- $return = NULL;
204
- $a = shortcode_atts( array(
205
- 'href' => NULL,
206
- 'width' => 340,
207
- 'height' => 130,
208
- 'cover' => NULL,
209
- 'facepile' => NULL,
210
- 'posts' => NULL,
211
- 'tabs' => array(),
212
- 'language' => get_bloginfo('language'),
213
- 'cta' => NULL,
214
- 'small' => NULL,
215
- 'adapt' => NULL,
216
- 'link' => true,
217
- 'linktext' => NULL,
218
- 'standard' => 'html5',
219
- '_implementation' => 'shortcode'
220
- ), $filter );
221
- if(isset($a['href']) && !empty($a['href'])){
222
- $a['language'] = str_replace("-", "_", $a['language']);
223
-
224
- //Send the language as a parameter to the SDK
225
- wp_localize_script( 'facebook-page-plugin-sdk', 'facebook_page_plugin_language', array( 'language' => $a['language'] ) );
226
-
227
- $return .= '<div class="cameronjonesweb_facebook_page_plugin" data-version="' . CJW_FBPP_PLUGIN_VER . '" data-implementation="' . esc_attr( $a['_implementation'] ) . '" id="' . $this->facebook_page_plugin_generate_wrapper_id() . '">';
228
- $return .= '<div id="fb-root"></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&version=v3.2&appId=' . self::app_id() . '";fjs.parentNode.insertBefore(js, fjs); }(document, \'script\', \'facebook-jssdk\'));</script>';
229
- $return .= '<div class="fb-page" data-href="https://facebook.com/' . $a["href"] . '" ';
230
- if(isset($a['width']) && !empty($a['width'])){
231
- $return .= ' data-width="' . $a['width'] . '"';
232
- $return .= ' data-max-width="' . $a['width'] . '"';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
233
  }
234
- if(isset($a['height']) && !empty($a['height'])){
235
- $return .= ' data-height="' . $a['height'] . '"';
 
 
 
236
  }
237
- if(isset($a['cover']) && !empty($a['cover'])){
238
- if($a['cover'] == "false"){
239
  $return .= ' data-hide-cover="true"';
240
- } else if($a['cover'] == "true"){
241
  $return .= ' data-hide-cover="false"';
242
- }
243
  }
244
- if(isset($a['facepile']) && !empty($a['facepile'])){
245
  $return .= ' data-show-facepile="' . $a['facepile'] . '"';
246
  }
247
- if(isset($a['tabs']) && !empty($a['tabs'])){
248
- $return .= ' data-tabs="' . $a['tabs'] . '"';
249
- } else if(isset($a['posts']) && !empty($a['posts'])){
250
- if($a['posts'] == 'true'){
 
 
 
251
  $return .= ' data-tabs="timeline"';
252
  } else {
253
  $return .= ' data-tabs="false"';
254
  }
255
  }
256
- if(isset($a['cta']) && !empty($a['cta'])){
257
  $return .= ' data-hide-cta="' . $a['cta'] . '"';
 
 
 
 
258
  }
259
- if(isset($a['small']) && !empty($a['small'])){
260
- $return .= ' data-small-header="' . $a['small'] . '"';
 
 
 
261
  }
262
- if(isset($a['adapt']) && !empty($a['adapt'])){
263
- $return .= ' data-adapt-container-width="' . $a['adapt'] . '"';
264
  } else {
265
  $return .= ' data-adapt-container-width="false"';
266
  }
267
  $return .= '><div class="fb-xfbml-parse-ignore">';
268
- if( $a['link'] == 'true' ){
269
- $return .= '<blockquote cite="https://www.facebook.com/' . $a['href'] . '">';
270
- $return .= '<a href="https://www.facebook.com/' . $a['href'] . '">';
271
- if( empty( $a['linktext'] ) ) {
272
- $return .= 'https://www.facebook.com/' . $a['href'];
 
 
273
  } else {
274
- $return .= $a['linktext'];
275
  }
276
- $return .= '</a>';
277
- $return .= '</blockquote>';
278
  }
279
  $return .= '</div></div></div>';
280
  }
@@ -610,7 +644,7 @@ class cameronjonesweb_facebook_page_plugin_widget extends WP_Widget {
610
  esc_attr( $this->get_field_id( 'language' ) ),
611
  esc_html__( 'Language:', 'facebook-page-feed-graph-api' ),
612
  esc_attr( $this->get_field_name( 'language' ) ),
613
- (
614
  function() use ( $langs, $language ) {
615
  $return = '<option value="">' . esc_html__( 'Site Language (default)', 'facebook-page-feed-graph-api' ) . '</option>';
616
  foreach ( $langs as $lang ) {
@@ -623,7 +657,7 @@ class cameronjonesweb_facebook_page_plugin_widget extends WP_Widget {
623
  }
624
  return $return;
625
  }
626
- )()
627
  );
628
  }
629
 
3
  * Plugin Name: Mongoose Page Plugin
4
  * Plugin URI: https://mongoosemarketplace.com/downloads/facebook-page-plugin/
5
  * Description: The most popular way to display the Facebook Page Plugin on your WordPress website. Easy implementation using a shortcode or widget. Now available in 95 different languages
6
+ * Version: 1.7.3
7
  * Author: Mongoose Marketplace
8
  * Author URI: https://mongoosemarketplace.com/
9
  * License: GPLv2
32
  define( 'CJW_FBPP_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
33
  define( 'CJW_FBPP_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
34
  define( 'CJW_FBPP_PLUGIN_BASENAME', plugin_basename( __FILE__ ) );
35
+ define( 'CJW_FBPP_PLUGIN_VER', '1.7.3' );
36
  define( 'CJW_FBPP_PLUGIN_DONATE_LINK', 'https://www.patreon.com/cameronjonesweb' );
37
  define( 'CJW_FBPP_PLUGIN_SURVEY_LINK', 'https://cameronjonesweb.typeform.com/to/BllbYm' );
38
 
196
  return substr( str_shuffle( str_repeat( implode( '', array_merge( range( 'A', 'Z' ), range( 'a', 'z' ) ) ), 5 ) ), 0, 15 );
197
  }
198
 
199
+ /**
200
+ * Parse shortcode
201
+ *
202
+ * @param array $filter Supplied shortcode attributes.
203
+ * @return string
204
+ */
205
+ public function facebook_page_plugin( $filter ) {
206
+ wp_enqueue_script( 'facebook-page-plugin-sdk', CJW_FBPP_PLUGIN_URL . 'js/sdk.js', array(), CJW_FBPP_PLUGIN_VER, true );
207
+ wp_enqueue_script( 'facebook-page-plugin-responsive-script', CJW_FBPP_PLUGIN_URL . 'js/responsive.min.js', 'jquery', CJW_FBPP_PLUGIN_VER, true );
208
+ $return = '';
209
+ $a = shortcode_atts(
210
+ array(
211
+ 'href' => null,
212
+ 'width' => 340,
213
+ 'height' => 130,
214
+ 'cover' => null,
215
+ 'facepile' => null,
216
+ 'posts' => null,
217
+ 'tabs' => array(),
218
+ 'language' => get_bloginfo( 'language' ),
219
+ 'cta' => null,
220
+ 'small' => null,
221
+ 'adapt' => null,
222
+ 'link' => true,
223
+ 'linktext' => null,
224
+ '_implementation' => 'shortcode',
225
+ ),
226
+ $filter
227
+ );
228
+ if ( isset( $a['href'] ) && ! empty( $a['href'] ) ) {
229
+ $a['language'] = str_replace( '-', '_', $a['language'] );
230
+
231
+ // Send the language as a parameter to the SDK.
232
+ wp_localize_script( 'facebook-page-plugin-sdk', 'facebook_page_plugin_language', array( 'language' => esc_attr( $a['language'] ) ) );
233
+
234
+ $return .= sprintf(
235
+ '<div class="cameronjonesweb_facebook_page_plugin" data-version="%1$s" data-implementation="%2$s" id="%3$s">',
236
+ esc_attr( CJW_FBPP_PLUGIN_VER ),
237
+ esc_attr( $a['_implementation'] ),
238
+ esc_attr( $this->facebook_page_plugin_generate_wrapper_id() )
239
+ );
240
+ $return .= sprintf(
241
+ '<div id="fb-root"></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&version=v3.2&appId=%1$s";fjs.parentNode.insertBefore(js, fjs); }(document, \'script\', \'facebook-jssdk\'));</script>',
242
+ esc_attr( self::app_id() )
243
+ );
244
+ $return .= sprintf(
245
+ '<div class="fb-page" data-href="https://facebook.com/%1$s" ',
246
+ esc_attr( $a['href'] )
247
+ );
248
+ if ( isset( $a['width'] ) && ! empty( $a['width'] ) ) {
249
+ $return .= sprintf(
250
+ ' data-width="%1$s" data-max-width="%1$s"',
251
+ esc_attr( $a['width'] )
252
+ );
253
  }
254
+ if ( isset( $a['height'] ) && ! empty( $a['height'] ) ) {
255
+ $return .= sprintf(
256
+ ' data-height="%1$s"',
257
+ esc_attr( $a['height'] )
258
+ );
259
  }
260
+ if ( isset( $a['cover'] ) && ! empty( $a['cover'] ) ) {
261
+ if ( 'false' == $a['cover'] ) {
262
  $return .= ' data-hide-cover="true"';
263
+ } elseif ( 'true' == $a['cover'] ) {
264
  $return .= ' data-hide-cover="false"';
265
+ }
266
  }
267
+ if ( isset( $a['facepile'] ) && ! empty( $a['facepile'] ) ) {
268
  $return .= ' data-show-facepile="' . $a['facepile'] . '"';
269
  }
270
+ if ( isset( $a['tabs'] ) && ! empty( $a['tabs'] ) ) {
271
+ $return .= sprintf(
272
+ ' data-tabs="%1$s"',
273
+ esc_attr( $a['tabs'] )
274
+ );
275
+ } elseif ( isset( $a['posts'] ) && ! empty( $a['posts'] ) ) {
276
+ if ( 'true' == $a['posts'] ) {
277
  $return .= ' data-tabs="timeline"';
278
  } else {
279
  $return .= ' data-tabs="false"';
280
  }
281
  }
282
+ if ( isset( $a['cta'] ) && ! empty( $a['cta'] ) ) {
283
  $return .= ' data-hide-cta="' . $a['cta'] . '"';
284
+ $return .= sprintf(
285
+ ' data-hide-cta="%1$s"',
286
+ esc_attr( $a['cta'] )
287
+ );
288
  }
289
+ if ( isset( $a['small'] ) && ! empty( $a['small'] ) ) {
290
+ $return .= sprintf(
291
+ ' data-small-header="%1$s"',
292
+ esc_attr( $a['small'] )
293
+ );
294
  }
295
+ if ( isset( $a['adapt'] ) && ! empty( $a['adapt'] ) ) {
296
+ $return .= ' data-adapt-container-width="true"';
297
  } else {
298
  $return .= ' data-adapt-container-width="false"';
299
  }
300
  $return .= '><div class="fb-xfbml-parse-ignore">';
301
+ if ( 'true' == $a['link'] ) {
302
+ $return .= sprintf(
303
+ '<blockquote cite="https://www.facebook.com/%1$s"><a href="https://www.facebook.com/%1$s">',
304
+ esc_attr( $a['href'] )
305
+ );
306
+ if ( empty( $a['linktext'] ) ) {
307
+ $return .= 'https://www.facebook.com/' . esc_attr( $a['href'] );
308
  } else {
309
+ $return .= esc_html( $a['linktext'] );
310
  }
311
+ $return .= '</a></blockquote>';
 
312
  }
313
  $return .= '</div></div></div>';
314
  }
644
  esc_attr( $this->get_field_id( 'language' ) ),
645
  esc_html__( 'Language:', 'facebook-page-feed-graph-api' ),
646
  esc_attr( $this->get_field_name( 'language' ) ),
647
+ call_user_func(
648
  function() use ( $langs, $language ) {
649
  $return = '<option value="">' . esc_html__( 'Site Language (default)', 'facebook-page-feed-graph-api' ) . '</option>';
650
  foreach ( $langs as $lang ) {
657
  }
658
  return $return;
659
  }
660
+ )
661
  );
662
  }
663
 
readme.md CHANGED
@@ -1,4 +1,4 @@
1
- [![Build Status](https://api.travis-ci.org/cameronjonesweb/facebook-page-feed-graph-api.svg)](https://travis-ci.org/cameronjonesweb/facebook-page-feed-graph-api)
2
 
3
  # Mongoose Page Plugin
4
 
@@ -46,6 +46,10 @@ On your dashboard. We'll be improving how this is implemented in future versions
46
 
47
  ## Changelog
48
 
 
 
 
 
49
  ### 1.7.2 - 13/04/20
50
  * Improved processing of the widget URL field
51
  * Tested for WordPress 5.4 'Adderley'
1
+ [![Build Status](https://api.travis-ci.org/cameronjonesweb/facebook-page-feed-graph-api.svg)](https://travis-ci.org/cameronjonesweb/facebook-page-feed-graph-api) [![RIPS CodeRisk](https://coderisk.com/wp/plugin/facebook-page-feed-graph-api/badge "RIPS CodeRisk")](https://coderisk.com/wp/plugin/facebook-page-feed-graph-api)
2
 
3
  # Mongoose Page Plugin
4
 
46
 
47
  ## Changelog
48
 
49
+ ### 1.7.3 - 14/05/20
50
+ * Fixed Immediately Invoked Function Expression that was breaking on PHP < 7.0
51
+ * Code quality improvements in shortcode render method
52
+
53
  ### 1.7.2 - 13/04/20
54
  * Improved processing of the widget URL field
55
  * Tested for WordPress 5.4 'Adderley'
readme.txt CHANGED
@@ -3,9 +3,9 @@ Contributors: cameronjonesweb, mongoosemarketplace
3
  Tags: like box,facebook like box,facebook page plugin, facebook feed, facebook page
4
  Donate link: https://www.patreon.com/cameronjonesweb
5
  Requires at least: 4.6
6
- Tested up to: 5.2
7
  Requires PHP: 5.3
8
- Stable tag: 1.7.2
9
  License: GPLv2
10
  License URI: http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
11
 
@@ -34,7 +34,7 @@ With more than 30,000 installs and over 50 5-star ratings, the Mongoose Page Plu
34
  The latest version of the API has removed show posts and replaced it with `tabs` which is more dynamic. To show just the posts, your tabs value should be "timeline". To hide the posts, `tabs` should be empty (shortcode) or select "none" (widget). If you're using the shortcode, remember that by default it shows the timeline so you must set it as either an empty or false value to hide posts ie `tabs=""` or `tabs="false"`. If the posts option is already being used it will be converted to tabs.
35
 
36
  = What languages are available? =
37
- As of version 1.2.0, the plugin is available in all languages provided by Facebook ( full list availabe [here](https://www.facebook.com/translations/FacebookLocales.xml) ). By default it uses the same language as the site, but alternatively you can specify the language in the shortcode. The dashboard widget is currently only available in English but is multilingual ready.
38
 
39
  = My Facebook page isn't loading =
40
  If the URL for your page is http://facebook.com/ABC123 then when you use the shortcode don't include the domain, instead use like so: `[facebook-page-plugin href="ABC123"]`
@@ -59,6 +59,10 @@ Chances are your plugin isn't tall enough to display the facepile properly. The
59
 
60
  == Changelog ==
61
 
 
 
 
 
62
  = 1.7.2 - 13/04/20 =
63
  * Improved processing of the widget URL field
64
  * Tested for WordPress 5.4 'Adderley'
@@ -225,5 +229,3 @@ Changes who can see the shortcode generator on the dashboard. Default: `edit_pos
225
  `facebook_page_plugin_app_id`
226
 
227
  Changes the Facebook App ID.
228
-
229
- [](http://coderisk.com/wp/plugin/facebook-page-feed-graph-api/RIPS-pefVtkhz2c)
3
  Tags: like box,facebook like box,facebook page plugin, facebook feed, facebook page
4
  Donate link: https://www.patreon.com/cameronjonesweb
5
  Requires at least: 4.6
6
+ Tested up to: 5.4
7
  Requires PHP: 5.3
8
+ Stable tag: 1.7.3
9
  License: GPLv2
10
  License URI: http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
11
 
34
  The latest version of the API has removed show posts and replaced it with `tabs` which is more dynamic. To show just the posts, your tabs value should be "timeline". To hide the posts, `tabs` should be empty (shortcode) or select "none" (widget). If you're using the shortcode, remember that by default it shows the timeline so you must set it as either an empty or false value to hide posts ie `tabs=""` or `tabs="false"`. If the posts option is already being used it will be converted to tabs.
35
 
36
  = What languages are available? =
37
+ As of version 1.2.0, the plugin is available in all languages provided by Facebook. By default it uses the same language as the site, but alternatively you can specify the language in the shortcode. The dashboard widget is currently only available in English but is multilingual ready.
38
 
39
  = My Facebook page isn't loading =
40
  If the URL for your page is http://facebook.com/ABC123 then when you use the shortcode don't include the domain, instead use like so: `[facebook-page-plugin href="ABC123"]`
59
 
60
  == Changelog ==
61
 
62
+ = 1.7.3 - 14/05/20 =
63
+ * Fixed Immediately Invoked Function Expression that was breaking on PHP < 7.0
64
+ * Code quality improvements in shortcode render method
65
+
66
  = 1.7.2 - 13/04/20 =
67
  * Improved processing of the widget URL field
68
  * Tested for WordPress 5.4 'Adderley'
229
  `facebook_page_plugin_app_id`
230
 
231
  Changes the Facebook App ID.