WP Embed Facebook - Version 1.9.6.2

Version Description

  • Fixed MultiSite error
Download this release

Release Info

Developer poxtron
Plugin Icon 128x128 WP Embed Facebook
Version 1.9.6.2
Comparing to
See all releases

Code changes from version 1.9.6.1 to 1.9.6.2

Files changed (3) hide show
  1. lib/core.php +45 -21
  2. readme.txt +10 -7
  3. wp-embed-facebook.php +1 -1
lib/core.php CHANGED
@@ -35,6 +35,30 @@ class WP_Embed_FB {
35
  foreach ($defaults as $option ) {
36
  delete_site_option($option);
37
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
38
  self::whois('uninstalled');
39
  return;
40
  }
@@ -88,34 +112,34 @@ class WP_Embed_FB {
88
  * Enqueue wp embed facebook styles
89
  */
90
  static function wp_enqueue_scripts(){
91
- if(get_option('wpemfb_enqueue_style') == 'true'){
92
- $theme = get_option('wpemfb_theme');
93
  wp_register_style( 'wpemfb-style', WPEMFBURL.'templates/'.$theme.'/wpemfb.css');
94
  wp_register_style( 'wpemfb-lightbox', WPEMFBURL.'lib/lightbox2/css/lightbox.css');
95
  wp_enqueue_style('wpemfb-style');
96
  wp_enqueue_style('wpemfb-lightbox');
97
  }
98
- if(get_option('wpemfb_enq_lightbox') == 'true'){
99
  wp_enqueue_script(
100
  'wpemfb-lightbox',
101
  WPEMFBURL.'lib/lightbox2/js/lightbox.min.js',
102
  array( 'jquery' )
103
  );
104
  }
105
- if(get_option('wpemfb_enq_wpemfb') == 'true'){
106
  wp_enqueue_script(
107
  'wpemfb',
108
  WPEMFBURL.'lib/js/wpembedfb.js',
109
  array( 'jquery' )
110
  );
111
  }
112
- if(get_option('wpemfb_enq_fbjs') == 'true'){
113
  wp_enqueue_script(
114
  'wpemfbjs',
115
  WPEMFBURL.'lib/js/fb.js',
116
  array( 'jquery' )
117
  );
118
- $translation_array = array( 'local' => get_locale(), 'fb_id'=>get_option('wpemfb_app_id') );
119
  wp_localize_script( 'wpemfbjs', 'WEF', $translation_array );
120
  }
121
  }
@@ -185,8 +209,8 @@ class WP_Embed_FB {
185
  $raw_photo = self::$raw;
186
  $raw_video = self::$raw;
187
  } else {
188
- $raw_photo = get_option('wpemfb_raw_photo') == 'true' ? 'true' : 'false';
189
- $raw_video = get_option('wpemfb_raw_video') == 'true' ? 'true' : 'false';
190
  }
191
  //is video
192
  if (isset($vars['v'])) { //is video
@@ -233,7 +257,7 @@ class WP_Embed_FB {
233
  $wp_emb_fbsdk = self::$fbsdk;
234
  try {
235
  if($type == 'album')
236
- $api_string = $fb_id.'?fields=name,id,from,description,photos.fields(name,picture,source).limit('.get_option("wpemfb_max_photos").')';
237
  else
238
  $api_string = $fb_id;
239
 
@@ -248,11 +272,11 @@ class WP_Embed_FB {
248
  *
249
  */
250
  $fb_data = $wp_emb_fbsdk->api('/v2.3/'.apply_filters('wpemfb_api_string',$api_string,$fb_id,$type));
251
- $num_posts = self::$num_posts !== '' && is_numeric(self::$num_posts) ? self::$num_posts : get_option("wpemfb_max_posts");
252
  $api_string2 = '';
253
  if(isset($fb_data['embed_html']))
254
  $fb_data = array_merge($fb_data,array('is_video' => '1'));
255
- elseif( isset($fb_data['category']) && get_option("wpemfb_show_posts") == "true")
256
  $api_string2 = '/'.$fb_data['id'].'?fields=posts.limit('.$num_posts.'){message,shares,link,picture,object_id,likes.limit(1).summary(true),comments.limit(1).summary(true)}';
257
 
258
  /**
@@ -343,14 +367,14 @@ class WP_Embed_FB {
343
  }
344
  //get default variables to use on templates
345
  if(empty(self::$width)){
346
- $width = get_option('wpemfb_max_width');
347
- $height = get_option('wpemfb_height');
348
  } else {
349
  $width = self::$width;
350
  $height = self::$height;
351
  }
352
  $poster = self::$poster;
353
- $prop = get_option('wpemfb_proportions');
354
  ob_start();
355
  //show embed post on admin
356
  if(is_admin() && isset($fb_data['is_post'])) : ?>
@@ -375,7 +399,7 @@ class WP_Embed_FB {
375
  * @return string Template location
376
  */
377
  static function locate_template($template_name){
378
- $theme = get_option('wpemfb_theme');
379
  $located = locate_template(array('plugins/'.WPEMFBSLUG.'/'.$template_name.'.php'));
380
  $file = '/templates/'.$theme.'/'.$template_name.'.php';
381
  if(empty($located)){
@@ -407,7 +431,7 @@ class WP_Embed_FB {
407
  * @param bool $faces show faces
408
  */
409
  static function like_btn($fb_id,$likes=null,$share=false,$faces=false){
410
- $opt = get_option('wpemfb_show_like');
411
  if($opt === 'true') :
412
  ob_start();
413
  ?>
@@ -431,7 +455,7 @@ class WP_Embed_FB {
431
  * @param int $fb_id facebook id or username
432
  */
433
  static function follow_btn($fb_id){
434
- $opt = get_option('wpemfb_show_follow');
435
  if($opt === 'true') :
436
  ob_start();
437
  ?>
@@ -456,7 +480,7 @@ class WP_Embed_FB {
456
  if(!empty($atts) && isset($atts[0])){
457
  $url = '<p>'.trim($atts[0],'=').'</p>';
458
  if(isset($atts['width'])){
459
- $prop = get_option('wpemfb_proportions');
460
  self::$width = $atts['width'];
461
  self::$height = $prop * $atts['width'];
462
  }
@@ -481,7 +505,7 @@ class WP_Embed_FB {
481
  return $root.$ct;
482
  }
483
  static function plugins_loaded(){
484
- $lic = get_option('wpemfb_license','');
485
  if(class_exists('Wpemfb_Premium') && !empty($lic) )
486
  self::$premium = true;
487
  else
@@ -498,8 +522,8 @@ class FaceInit {
498
  static function init(){
499
  require('fb/facebook.php');
500
  $config = array();
501
- $config['appId'] = get_option('wpemfb_app_id');
502
- $config['secret'] = get_option('wpemfb_app_secret');
503
  $config['fileUpload'] = false; // optional
504
  if($config['appId'] != '0' && $config['secret'] != '0' )
505
  self::$fbsdk = new Sigami_Facebook($config);
35
  foreach ($defaults as $option ) {
36
  delete_site_option($option);
37
  }
38
+ // if ( is_multisite() ) {
39
+ // $ms_sites = wp_get_sites();
40
+ //
41
+ // if( 0 < sizeof( $ms_sites ) ) {
42
+ // foreach ( $ms_sites as $ms_site ) {
43
+ // switch_to_blog( $ms_site['blog_id'] );
44
+ // if( sizeof( $option_names ) > 0 ) {
45
+ // foreach( $option_names as $option_name ) {
46
+ // delete_option( $option_name );
47
+ // plugin_uninstalled();
48
+ // }
49
+ // }
50
+ // }
51
+ // }
52
+ //
53
+ // restore_current_blog();
54
+ // } else {
55
+ // if( sizeof( $option_names ) > 0 ) {
56
+ // foreach( $option_names as $option_name ) {
57
+ // delete_option( $option_name );
58
+ // plugin_uninstalled();
59
+ // }
60
+ // }
61
+ // }
62
  self::whois('uninstalled');
63
  return;
64
  }
112
  * Enqueue wp embed facebook styles
113
  */
114
  static function wp_enqueue_scripts(){
115
+ if(get_site_option('wpemfb_enqueue_style') == 'true'){
116
+ $theme = get_site_option('wpemfb_theme');
117
  wp_register_style( 'wpemfb-style', WPEMFBURL.'templates/'.$theme.'/wpemfb.css');
118
  wp_register_style( 'wpemfb-lightbox', WPEMFBURL.'lib/lightbox2/css/lightbox.css');
119
  wp_enqueue_style('wpemfb-style');
120
  wp_enqueue_style('wpemfb-lightbox');
121
  }
122
+ if(get_site_option('wpemfb_enq_lightbox') == 'true'){
123
  wp_enqueue_script(
124
  'wpemfb-lightbox',
125
  WPEMFBURL.'lib/lightbox2/js/lightbox.min.js',
126
  array( 'jquery' )
127
  );
128
  }
129
+ if(get_site_option('wpemfb_enq_wpemfb') == 'true'){
130
  wp_enqueue_script(
131
  'wpemfb',
132
  WPEMFBURL.'lib/js/wpembedfb.js',
133
  array( 'jquery' )
134
  );
135
  }
136
+ if(get_site_option('wpemfb_enq_fbjs') == 'true'){
137
  wp_enqueue_script(
138
  'wpemfbjs',
139
  WPEMFBURL.'lib/js/fb.js',
140
  array( 'jquery' )
141
  );
142
+ $translation_array = array( 'local' => get_locale(), 'fb_id'=>get_site_option('wpemfb_app_id') );
143
  wp_localize_script( 'wpemfbjs', 'WEF', $translation_array );
144
  }
145
  }
209
  $raw_photo = self::$raw;
210
  $raw_video = self::$raw;
211
  } else {
212
+ $raw_photo = get_site_option('wpemfb_raw_photo') == 'true' ? 'true' : 'false';
213
+ $raw_video = get_site_option('wpemfb_raw_video') == 'true' ? 'true' : 'false';
214
  }
215
  //is video
216
  if (isset($vars['v'])) { //is video
257
  $wp_emb_fbsdk = self::$fbsdk;
258
  try {
259
  if($type == 'album')
260
+ $api_string = $fb_id.'?fields=name,id,from,description,photos.fields(name,picture,source).limit('.get_site_option("wpemfb_max_photos").')';
261
  else
262
  $api_string = $fb_id;
263
 
272
  *
273
  */
274
  $fb_data = $wp_emb_fbsdk->api('/v2.3/'.apply_filters('wpemfb_api_string',$api_string,$fb_id,$type));
275
+ $num_posts = self::$num_posts !== '' && is_numeric(self::$num_posts) ? self::$num_posts : get_site_option("wpemfb_max_posts");
276
  $api_string2 = '';
277
  if(isset($fb_data['embed_html']))
278
  $fb_data = array_merge($fb_data,array('is_video' => '1'));
279
+ elseif( isset($fb_data['category']) && get_site_option("wpemfb_show_posts") == "true")
280
  $api_string2 = '/'.$fb_data['id'].'?fields=posts.limit('.$num_posts.'){message,shares,link,picture,object_id,likes.limit(1).summary(true),comments.limit(1).summary(true)}';
281
 
282
  /**
367
  }
368
  //get default variables to use on templates
369
  if(empty(self::$width)){
370
+ $width = get_site_option('wpemfb_max_width');
371
+ $height = get_site_option('wpemfb_height');
372
  } else {
373
  $width = self::$width;
374
  $height = self::$height;
375
  }
376
  $poster = self::$poster;
377
+ $prop = get_site_option('wpemfb_proportions');
378
  ob_start();
379
  //show embed post on admin
380
  if(is_admin() && isset($fb_data['is_post'])) : ?>
399
  * @return string Template location
400
  */
401
  static function locate_template($template_name){
402
+ $theme = get_site_option('wpemfb_theme');
403
  $located = locate_template(array('plugins/'.WPEMFBSLUG.'/'.$template_name.'.php'));
404
  $file = '/templates/'.$theme.'/'.$template_name.'.php';
405
  if(empty($located)){
431
  * @param bool $faces show faces
432
  */
433
  static function like_btn($fb_id,$likes=null,$share=false,$faces=false){
434
+ $opt = get_site_option('wpemfb_show_like');
435
  if($opt === 'true') :
436
  ob_start();
437
  ?>
455
  * @param int $fb_id facebook id or username
456
  */
457
  static function follow_btn($fb_id){
458
+ $opt = get_site_option('wpemfb_show_follow');
459
  if($opt === 'true') :
460
  ob_start();
461
  ?>
480
  if(!empty($atts) && isset($atts[0])){
481
  $url = '<p>'.trim($atts[0],'=').'</p>';
482
  if(isset($atts['width'])){
483
+ $prop = get_site_option('wpemfb_proportions');
484
  self::$width = $atts['width'];
485
  self::$height = $prop * $atts['width'];
486
  }
505
  return $root.$ct;
506
  }
507
  static function plugins_loaded(){
508
+ $lic = get_site_option('wpemfb_license','');
509
  if(class_exists('Wpemfb_Premium') && !empty($lic) )
510
  self::$premium = true;
511
  else
522
  static function init(){
523
  require('fb/facebook.php');
524
  $config = array();
525
+ $config['appId'] = get_site_option('wpemfb_app_id');
526
+ $config['secret'] = get_site_option('wpemfb_app_secret');
527
  $config['fileUpload'] = false; // optional
528
  if($config['appId'] != '0' && $config['secret'] != '0' )
529
  self::$fbsdk = new Sigami_Facebook($config);
readme.txt CHANGED
@@ -4,17 +4,17 @@ Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_i
4
  Tags: Facebook, facebook, Social Plugins, embed facebook, facebook video, facebook posts, facebook publication, facebook publications, facebook event, facebook events, facebook pages, facebook page, facebook profiles, facebook album, facebook albums, facebook photos, facebook photo, social,
5
  Requires at least: 3.8.1
6
  Tested up to: 4.2.3
7
- Stable tag: 1.9.6.1
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
11
- Embed a Facebook video, page, event, album, photo, profile or post to any Wordpress post or page.
12
 
13
  == Description ==
14
 
15
- **[Demo](http://www.wpembedfb.com/demo/)**
16
 
17
- Embed any public facebook video, page, post, profile, photo or event directly into a wordpress post, without having to write a single line of code. Simply put the facebook url on a separate line on the content of any post, and this plugin will fetch data associated with that url and display it, if the data is not public, like “invite only” events or private profiles, will return a link.
18
 
19
  = Supported Embeds =
20
  * Facebook Videos
@@ -67,7 +67,7 @@ It is possible that another plugin or your theme already has the Facebook SDK fo
67
 
68
  = Is there a way to embed an album with more than 100 photos ? =
69
 
70
- This is a facebook limitation, will try to work around it and update this feature on the premium plugin.
71
 
72
  = How to change embedded post background =
73
 
@@ -82,6 +82,9 @@ The embedded post code comes directly from facebook so there is no easy way to c
82
 
83
  == Changelog ==
84
 
 
 
 
85
  = 1.9.6.1 =
86
  * Fixed headers already sent notice.
87
  * Added Links to Facebook Apps and plugin settings
@@ -203,5 +206,5 @@ The embedded post code comes directly from facebook so there is no easy way to c
203
 
204
  == Upgrade Notice ==
205
 
206
- = 1.9.6.1 =
207
- * Fixed headers already sent notice.
4
  Tags: Facebook, facebook, Social Plugins, embed facebook, facebook video, facebook posts, facebook publication, facebook publications, facebook event, facebook events, facebook pages, facebook page, facebook profiles, facebook album, facebook albums, facebook photos, facebook photo, social,
5
  Requires at least: 3.8.1
6
  Tested up to: 4.2.3
7
+ Stable tag: 1.9.6.2
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
11
+ Embed a Facebook video, page, event, album, photo, profile or post to any WordPress post or page.
12
 
13
  == Description ==
14
 
15
+ Embed any public facebook video, page, post, profile, photo or event directly into a WordPress post, without having to write a single line of code. Simply put the facebook url on a separate line on the content of any post, and this plugin will fetch data associated with that url and display it. If the data is not public, like “invite only” events or private profiles it will return a link.
16
 
17
+ **[Demo](http://www.wpembedfb.com/demo/)**
18
 
19
  = Supported Embeds =
20
  * Facebook Videos
67
 
68
  = Is there a way to embed an album with more than 100 photos ? =
69
 
70
+ This is a facebook limitation, will try to work around it.
71
 
72
  = How to change embedded post background =
73
 
82
 
83
  == Changelog ==
84
 
85
+ = 1.9.6.2 =
86
+ * Fixed MultiSite error
87
+
88
  = 1.9.6.1 =
89
  * Fixed headers already sent notice.
90
  * Added Links to Facebook Apps and plugin settings
206
 
207
  == Upgrade Notice ==
208
 
209
+ = 1.9.6.2 =
210
+ * Fixed MultiSite error.
wp-embed-facebook.php CHANGED
@@ -4,7 +4,7 @@ Plugin Name: WP Embed Facebook
4
  Plugin URI: http://www.wpembedfb.com
5
  Description: Embed a Facebook video, photo, album, event, page, profile, or post. Copy any facebook url to a single line on your post, or use shortcode [facebook='url' width='' ] more info at <a href="http://www.wpembedfb.com" title="plugin website">www.wpembedfb.com</a>
6
  Author: Miguel Sirvent
7
- Version: 1.9.6.1
8
  Author URI: http://profiles.wordpress.org/poxtron/
9
  */
10
 
4
  Plugin URI: http://www.wpembedfb.com
5
  Description: Embed a Facebook video, photo, album, event, page, profile, or post. Copy any facebook url to a single line on your post, or use shortcode [facebook='url' width='' ] more info at <a href="http://www.wpembedfb.com" title="plugin website">www.wpembedfb.com</a>
6
  Author: Miguel Sirvent
7
+ Version: 1.9.6.2
8
  Author URI: http://profiles.wordpress.org/poxtron/
9
  */
10