WP Embed Facebook - Version 1.6

Version Description

  • Responsive Template
  • Posts on Page Embeds
  • Album Photo Count
  • Fixes on Admin Page
  • Remove of unnecesary code
Download this release

Release Info

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

Code changes from version 1.5.3 to 1.6

lib/admin.php CHANGED
@@ -15,6 +15,12 @@ class EmbFbAdmin{
15
  update_option('wpemfb_max_width', $_POST['wpemfb_max_width']);
16
  update_option('wpemfb_height', $prop );
17
  }
 
 
 
 
 
 
18
  if(isset($_POST['wpemfb_theme'])){
19
  update_option('wpemfb_theme', $_POST['wpemfb_theme']);
20
  }
@@ -48,6 +54,11 @@ class EmbFbAdmin{
48
  }else{
49
  update_option('wpemfb_raw_photo', 'false');
50
  }
 
 
 
 
 
51
  }
52
  }
53
  static function embedfb_page() {
@@ -60,6 +71,7 @@ class EmbFbAdmin{
60
  $checked4 = (get_option('wpemfb_show_follow') === 'true') ? 'checked' : '' ;
61
  $checked5 = (get_option('wpemfb_raw_video') === 'true') ? 'checked' : '' ;
62
  $checked6 = (get_option('wpemfb_raw_photo') === 'true') ? 'checked' : '' ;
 
63
  $sel1 = (get_option('wpemfb_theme') === 'default') ? 'selected' : '' ;
64
  $sel2 = (get_option('wpemfb_theme') === 'classic') ? 'selected' : '' ;
65
  ?>
@@ -68,28 +80,53 @@ class EmbFbAdmin{
68
  <div class="welcome-panel">
69
  <div class="welcome-panel-content">
70
  <div class="welcome-panel-column-container">
71
- <div class="welcome-panel-column">
72
  <form id="config-form" action="#" method="post">
 
 
73
  <table class="form-table">
74
- <?php wp_nonce_field( 'wp-embed-facebook','save-data' ); ?>
75
  <tbody>
76
- <tr>
77
- <h3><?php _e('Facebook application data', 'wp-embed-facebook') ?></h3>
78
- </tr>
79
  <tr valign="middle">
80
  <th>App ID</th>
81
  <td>
82
- <input type="text" name="wpemfb_app_id" required value="<?php echo get_option('wpemfb_app_id') ?>" />
83
  </td>
84
  </tr>
85
  <tr valign="middle">
86
  <th>App Secret</th>
87
  <td>
88
- <input type="text" name="wpemfb_app_secret" required value="<?php echo get_option('wpemfb_app_secret') ?>" />
89
  </td>
90
  </tr>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
91
  <tr>
92
- <th><?php _e("Theme to use", 'wp-embed-facebook') ?></th>
93
  <td>
94
  <select name="wpemfb_theme">
95
  <option value="default" <?php echo $sel1 ?> >Default</option>
@@ -98,12 +135,17 @@ class EmbFbAdmin{
98
  </td>
99
  </tr>
100
  <tr valign="middle">
101
- <th><?php _e('Fb Cover Embed Width','wp-embed-facebook') ?></th>
102
  <td>
103
- <input type="text" name="wpemfb_max_width" value="<?php echo get_option('wpemfb_max_width') ?>" />
104
  </td>
105
  </tr>
106
-
 
 
 
 
 
107
  <tr valign="middle">
108
  <th><?php _e('Embed video as Post','wp-embed-facebook') ?></th>
109
  <td>
@@ -115,25 +157,18 @@ class EmbFbAdmin{
115
  <td>
116
  <input type="checkbox" name="wpemfb_raw_photo" <?php echo $checked6 ?> />
117
  </td>
118
- </tr>
119
- <tr valign="middle">
120
- <th><?php _e('Add like button to embedded pages','wp-embed-facebook') ?></th>
121
- <td>
122
- <input type="checkbox" name="wpemfb_show_like" <?php echo $checked2 ?> />
123
- </td>
124
- </tr>
125
  <tr valign="middle">
126
  <th><?php _e('Show follow button','wp-embed-facebook') ?></th>
127
  <td>
128
  <input type="checkbox" name="wpemfb_show_follow" <?php echo $checked4 ?> />
129
  </td>
130
- </tr>
131
-
132
- <tr>
133
- <th>
134
- <h4><?php _e("Advanced Options", 'wp-embed-facebook') ?></h4>
135
- </th>
136
- </tr>
137
  <tr valign="middle">
138
  <th><?php _e('Enqueue Styles','wp-embed-facebook') ?></th>
139
  <td>
@@ -154,61 +189,53 @@ class EmbFbAdmin{
154
  </tr>
155
  </tbody>
156
  </table>
157
- </form
158
- <ul class="">
159
- <!--
160
- <li>
161
- <a href="http://www.saliuitl.org/wp-embed-fb/customize"><?php _e('Customize','wp-embed-facebook') ?></a>
162
- </li>
163
- <li>
164
- <a href="http://www.saliuitl.org/wp-embed-fb/support"><?php _e('Support','wp-embed-facebook') ?></a>
165
- </li>
166
- -->
167
- <li>
168
- <a href="http://www.saliuitl.org/en/wp-embed-facebook"><?php _e('Plugin Web Site','wp-embed-facebook') ?></a>
169
- </li>
170
- </ul>
171
- </div>
172
- <div class="welcome-panel-column">
173
- <p></p>
174
  </div>
175
- <div class="welcome-panel-column welcome-panel-last">
176
- <h3 style="color:red;"><?php _e('Donate!', 'wp-embed-facebook') ?></h3>
177
  <p><?php _e('Help me keep this plugin up to date', 'wp-embed-facebook') ?></p>
178
- <p><strong><?php _e('Click the taco !', 'wp-embed-facebook') ?></strong></p>
179
- <form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_top">
180
- <input type="hidden" name="cmd" value="_s-xclick">
181
- <input type="hidden" name="hosted_button_id" value="9TEJ8CGXMJEDG">
182
- <input type="image" src="http://saliuitl.org/img/taco.png" border="0" name="submit" alt="PayPal, la forma más segura y rápida de pagar en línea.">
183
- <img alt="" border="0" src="https://www.paypalobjects.com/es_XC/i/scr/pixel.gif" width="1" height="1">
184
- </form>
185
  <img src="<?php echo plugins_url('/img/paypal.png', __FILE__) ?>" width="50px" />
 
186
  <p>
187
- <h3 style="color:red;"><?php _e('Searching for the Premium version ?', 'wp-embed-facebook') ?></h3>
188
  <ul>
189
  <li>
190
- <?php _e('Custom templates', 'wp-embed-facebook') ?>
191
  </li>
192
  <li>
193
- <?php _e('Compatibility with all themes imaginable', 'wp-embed-facebook') ?>
194
  </li>
195
  <li>
196
- <?php _e("Multiple fb app id's per each multisite site", 'wp-embed-facebook') ?>
197
  </li>
198
  </ul>
199
- <h4 style="color:#01007E;"><?php _e('Comming Soon', 'wp-embed-facebook') ?></h4>
200
  </p>
 
 
 
 
 
 
 
 
 
201
  <p style="text-align: center">
202
- <img src="<?php echo plugins_url('/img/hechoenmexico.png', __FILE__) ?>" width="80px" />
203
  </p>
204
-
205
  </div>
206
  <!-- <div class="welcome-panel-column welcome-panel-last"> -->
207
  </div>
208
  </div>
209
  </div>
210
- </div><!-- .wrap -->
211
-
212
 
213
  <?php
214
  }
15
  update_option('wpemfb_max_width', $_POST['wpemfb_max_width']);
16
  update_option('wpemfb_height', $prop );
17
  }
18
+ if(isset($_POST['wpemfb_max_photos'])){
19
+ update_option('wpemfb_max_photos', $_POST['wpemfb_max_photos']);
20
+ }
21
+ if(isset($_POST['wpemfb_max_posts'])){
22
+ update_option('wpemfb_max_posts', $_POST['wpemfb_max_posts']);
23
+ }
24
  if(isset($_POST['wpemfb_theme'])){
25
  update_option('wpemfb_theme', $_POST['wpemfb_theme']);
26
  }
54
  }else{
55
  update_option('wpemfb_raw_photo', 'false');
56
  }
57
+ if(isset($_POST['wpemfb_show_posts'])){
58
+ update_option('wpemfb_show_posts', 'true');
59
+ }else{
60
+ update_option('wpemfb_show_posts', 'false');
61
+ }
62
  }
63
  }
64
  static function embedfb_page() {
71
  $checked4 = (get_option('wpemfb_show_follow') === 'true') ? 'checked' : '' ;
72
  $checked5 = (get_option('wpemfb_raw_video') === 'true') ? 'checked' : '' ;
73
  $checked6 = (get_option('wpemfb_raw_photo') === 'true') ? 'checked' : '' ;
74
+ $checked7 = (get_option('wpemfb_show_posts') === 'true') ? 'checked' : '' ;
75
  $sel1 = (get_option('wpemfb_theme') === 'default') ? 'selected' : '' ;
76
  $sel2 = (get_option('wpemfb_theme') === 'classic') ? 'selected' : '' ;
77
  ?>
80
  <div class="welcome-panel">
81
  <div class="welcome-panel-content">
82
  <div class="welcome-panel-column-container">
83
+ <div class="welcome-panel-column " style="width: 55%">
84
  <form id="config-form" action="#" method="post">
85
+ <?php wp_nonce_field( 'wp-embed-facebook','save-data' ); ?>
86
+ <h3 style="color: #23487F;"><?php _e('Facebook application data', 'wp-embed-facebook') ?></h3>
87
  <table class="form-table">
 
88
  <tbody>
 
 
 
89
  <tr valign="middle">
90
  <th>App ID</th>
91
  <td>
92
+ <input type="text" name="wpemfb_app_id" required value="<?php echo get_option('wpemfb_app_id') ?>" size="29" />
93
  </td>
94
  </tr>
95
  <tr valign="middle">
96
  <th>App Secret</th>
97
  <td>
98
+ <input type="text" name="wpemfb_app_secret" required value="<?php echo get_option('wpemfb_app_secret') ?>" size="29" />
99
  </td>
100
  </tr>
101
+ </table>
102
+ <h3 style="color: #23487F;"><?php _e('Embedded Pages Options', 'wp-embed-facebook') ?></h3>
103
+ <table class="form-table">
104
+ <tbody>
105
+ <tr valign="middle">
106
+ <th><?php _e('Show like button','wp-embed-facebook') ?></th>
107
+ <td>
108
+ <input type="checkbox" name="wpemfb_show_like" <?php echo $checked2 ?> />
109
+ </td>
110
+ </tr>
111
+ <tr valign="middle">
112
+ <th><?php _e('Show latest posts','wp-embed-facebook') ?></th>
113
+ <td>
114
+ <input type="checkbox" name="wpemfb_show_posts" <?php echo $checked7 ?> />
115
+ </td>
116
+ </tr>
117
+ <tr valign="middle">
118
+ <th><?php _e('Number of posts','wp-embed-facebook') ?></th>
119
+ <td>
120
+ <input type="number" name="wpemfb_max_posts" value="<?php echo get_option('wpemfb_max_posts') ?>" />
121
+ </td>
122
+ </tr>
123
+ </tbody>
124
+ </table>
125
+ <h3 style="color: #23487F;"><?php _e('Other Options', 'wp-embed-facebook') ?></h3>
126
+ <table class="form-table">
127
+ <tbody>
128
  <tr>
129
+ <th><?php _e("Template to use", 'wp-embed-facebook') ?></th>
130
  <td>
131
  <select name="wpemfb_theme">
132
  <option value="default" <?php echo $sel1 ?> >Default</option>
135
  </td>
136
  </tr>
137
  <tr valign="middle">
138
+ <th><?php _e('Embed Max-Width','wp-embed-facebook') ?></th>
139
  <td>
140
+ <input type="number" name="wpemfb_max_width" value="<?php echo get_option('wpemfb_max_width') ?>" />
141
  </td>
142
  </tr>
143
+ <tr valign="middle">
144
+ <th><?php _e('Photos in Album','wp-embed-facebook') ?></th>
145
+ <td>
146
+ <input type="number" name="wpemfb_max_photos" value="<?php echo get_option('wpemfb_max_photos') ?>" />
147
+ </td>
148
+ </tr>
149
  <tr valign="middle">
150
  <th><?php _e('Embed video as Post','wp-embed-facebook') ?></th>
151
  <td>
157
  <td>
158
  <input type="checkbox" name="wpemfb_raw_photo" <?php echo $checked6 ?> />
159
  </td>
160
+ </tr>
 
 
 
 
 
 
161
  <tr valign="middle">
162
  <th><?php _e('Show follow button','wp-embed-facebook') ?></th>
163
  <td>
164
  <input type="checkbox" name="wpemfb_show_follow" <?php echo $checked4 ?> />
165
  </td>
166
+ </tr>
167
+ </tbody>
168
+ </table>
169
+ <h3 style="color: #23487F;"><?php _e('Advanced Options', 'wp-embed-facebook') ?></h3>
170
+ <table class="form-table">
171
+ <tbody>
 
172
  <tr valign="middle">
173
  <th><?php _e('Enqueue Styles','wp-embed-facebook') ?></th>
174
  <td>
189
  </tr>
190
  </tbody>
191
  </table>
192
+ </form>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
193
  </div>
194
+ <div class="welcome-panel-column welcome-panel-last " style="width: 40%">
195
+ <h3 style="color:#CF1912;"><?php _e('Donate!', 'wp-embed-facebook') ?></h3>
196
  <p><?php _e('Help me keep this plugin up to date', 'wp-embed-facebook') ?></p>
197
+ <p><strong><?php _e('Click the taco !', 'wp-embed-facebook') ?></strong></p>
198
+ <p>
199
+ <a href="https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=J373TWCMJ5CEY&lc=MX&item_name=WP%20Embed%20Facebook&no_note=1&no_shipping=1&rm=1&return=http%3a%2f%2fwww%2ewpembedfb%2ecom%2fyou%2dare%2dawesome&currency_code=USD&bn=PP%2dDonationsBF%3abtn_donateCC_LG%2egif%3aNonHosted">
200
+ <img src="<?php echo plugins_url('/img/taco.png', __FILE__) ?>" >
201
+ </a>
202
+ </p>
 
203
  <img src="<?php echo plugins_url('/img/paypal.png', __FILE__) ?>" width="50px" />
204
+ <hr>
205
  <p>
206
+ <h3 style="color:#CF1912;"><?php _e('Searching for the Premium version ?', 'wp-embed-facebook') ?></h3>
207
  <ul>
208
  <li>
209
+ <?php _e('Embed Full Pages', 'wp-embed-facebook') ?>
210
  </li>
211
  <li>
212
+ <?php _e('Embed Events with cover', 'wp-embed-facebook') ?>
213
  </li>
214
  <li>
215
+ <?php _e('More Resposive Teplates', 'wp-embed-facebook') ?>
216
  </li>
217
  </ul>
218
+ <h3 style="color:#23487F; text-align:center;"><?php _e('Comming Soon', 'wp-embed-facebook') ?></h3>
219
  </p>
220
+ <hr>
221
+ <h4 style="color:#23487F;"><?php _e('Shortcode Examples:', 'wp-embed-facebook') ?></h4>
222
+ <p><?php _e('Raw Photo', 'wp-embed-facebook') ?></p>
223
+ <p>[facebook=https://www.facebook.com/photo.php?fbid=10150777131437722&set=a.10150777131307722.434719.6798562721 raw=true]</p>
224
+ <p><?php _e('Raw is optional, and only works on photos and videos.', 'wp-embed-facebook') ?></p>
225
+ <p><?php _e('Event', 'wp-embed-facebook') ?></p>
226
+ <p>[facebook=https://www.facebook.com/events/611232852279921/ ]</p>
227
+ <p><strong><?php _e('You can avoid the shortcode by placing the url on a single line', 'wp-embed-facebook') ?></strong></p>
228
+ <hr>
229
  <p style="text-align: center">
230
+ <img src="<?php echo plugins_url('/img/hechoenmexico.png', __FILE__) ?>" width="60px" />
231
  </p>
232
+ <p><a href="http://www.wpembedfb.com"><?php _e('Plugin Web Site','wp-embed-facebook') ?></a></p>
233
  </div>
234
  <!-- <div class="welcome-panel-column welcome-panel-last"> -->
235
  </div>
236
  </div>
237
  </div>
238
+ </div><!-- .wrap -- 766>
 
239
 
240
  <?php
241
  }
lib/core.php CHANGED
@@ -19,12 +19,13 @@ class WP_Embed_FB {
19
  if($opt === false)
20
  update_option($option, $value);
21
  }
22
- else { // TODO: multiple fb apps for each site probably not needed for public data
23
  $opt = get_option($option);
24
  if($opt === false)
25
  update_site_option($option, $value);
26
  }
27
  }
 
28
  return;
29
  }
30
  /*
@@ -36,10 +37,11 @@ class WP_Embed_FB {
36
  if ( !is_multisite() ) {
37
  delete_option($option);
38
  }
39
- else { // TODO: multiple fb apps for each site
40
  delete_site_option($option);
41
  }
42
  }
 
43
  return;
44
  }
45
  /*
@@ -47,7 +49,10 @@ class WP_Embed_FB {
47
  */
48
  static function getdefaults(){
49
  return array(
50
- 'wpemfb_max_width' => '600',
 
 
 
51
  'wpemfb_enqueue_style' => 'true',
52
  'wpemfb_app_id' => '0',
53
  'wpemfb_app_secret' => '0',
@@ -61,11 +66,15 @@ class WP_Embed_FB {
61
  'wpemfb_raw_photo' => 'false',
62
  );
63
  }
 
 
 
 
64
  /*
65
  * load translations and facebook sdk
66
  */
67
  static function init(){
68
- load_plugin_textdomain( 'wp-embed-facebook', false, WPEMFBDIRFULL . '/lang' );
69
  FaceInit::init();
70
  }
71
  /*
@@ -73,8 +82,8 @@ class WP_Embed_FB {
73
  */
74
  static function wp_enqueue_scripts(){
75
  $theme = get_option('wpemfb_theme');
76
- wp_register_style( 'wpemfb-style', plugins_url('/wp-embed-facebook/templates/'.$theme.'/wpemfb.css'));
77
- wp_register_style( 'wpemfb-lightbox', plugins_url('/wp-embed-facebook/lib/lightbox2/css/lightbox.css'));
78
  if(get_option('wpemfb_enqueue_style') == 'true'){
79
  wp_enqueue_style('wpemfb-style');
80
  wp_enqueue_style('wpemfb-lightbox');
@@ -82,9 +91,15 @@ class WP_Embed_FB {
82
 
83
  wp_enqueue_script(
84
  'wpemfb-lightbox',
85
- plugins_url('/wp-embed-facebook/lib/lightbox2/js/lightbox.min.js'),
86
  array( 'jquery' )
87
  );
 
 
 
 
 
 
88
  }
89
  /*
90
  * the_content filter to process fb url's
@@ -103,7 +118,7 @@ class WP_Embed_FB {
103
  }
104
  /**
105
  * Extract fb_id from the url
106
- * @param array $match[2]=
107
  */
108
  static function fb_embed($match){ //TODO: photos!
109
 
@@ -139,6 +154,9 @@ class WP_Embed_FB {
139
  return self::print_fb_data($fb_data);
140
  }
141
 
 
 
 
142
  //photos and videos
143
  if( 'photo.php' == $last || ( array_search('photos',$clean) !== false ) ){
144
  if(!empty(self::$raw)){
@@ -168,17 +186,20 @@ class WP_Embed_FB {
168
 
169
  return self::fb_api_get($fb_id, $match[2], $type);
170
  }
171
- /*
172
  * get data from fb using $fbsdk->api('/'.$fb_id) :)
 
173
  */
174
- static function fb_api_get($fb_id, $url, $type){
175
  $wp_emb_fbsdk = self::$fbsdk;
176
  try {
177
  if(empty($type))
178
  $fb_data = $wp_emb_fbsdk->api('/'.$fb_id);
179
  elseif($type == 'album')
180
- $fb_data = $wp_emb_fbsdk->api('/'.$fb_id.'?fields=name,id,from,photos.fields(name,picture,source)');
181
  //$res = '<pre>'.print_r($fb_data,true).'</pre>'; //to inspect what elements are queried by default
 
 
182
  $res = self::print_fb_data($fb_data);
183
  } catch(FacebookApiException $e) {
184
  $res = '<p><a href="http://wwww.facebook.com/'.$url.'" target="_blank" rel="nofollow">http://wwww.facebook.com/'.$url.'</a>';
@@ -193,8 +214,9 @@ class WP_Embed_FB {
193
  }
194
  return $res;
195
  }
196
- /*
197
  * find out what kind of data we got from facebook
 
198
  */
199
  static function print_fb_data($fb_data){
200
  if(empty(self::$width)){
@@ -248,44 +270,25 @@ class WP_Embed_FB {
248
  */
249
  static function locate_template($template_name){
250
  $theme = get_option('wpemfb_theme');
251
- $located = locate_template(array('plugins/wp-embed-facebook/'.$template_name.'.php'));
252
  if(empty($located))
253
- $located = WPEMFBDIR.'/templates/'.$theme.'/'.$template_name.'.php';
254
  return $located;
255
  }
256
  /*
257
  * Formatting functions.
258
  */
259
- /*
260
  * If a user has a lot of websites registered on fb this function will only link to the first one
 
261
  */
262
  static function getwebsite($urls){
263
  $url = explode(' ',$urls);
264
- $clean = explode('?', $url[0]);
265
- $cleaner = str_replace(array('http://', 'https://'), array('',''), $clean[0]);
266
- $ret = '<a href="http://'.$cleaner.'" title="'.__('Web Site', 'wp-embed-facebook').'" target="_blank">'.__('Web Site','wp-embed-facebook').'</a>';
267
- return $ret;
268
  }
269
- /*
270
- * Translate fb categories to current locale
271
- */
272
- static function fb_categories($category){
273
- $fbcats = array(
274
- __('Museum/art gallery') ,
275
- __('Local business'),
276
- __('Concert venue'),
277
- __('Public places'),
278
- );
279
- //$catsflip = array_flip($fbcats); TODO: Translate categories
280
- if($id = array_search($category, $fbcats) !== false)
281
- echo $fbcats[$id];
282
- else
283
- echo (string)$category;
284
- return;
285
- //$replace = array('Museo - Galería de Arte','Negocio Local','Sala de Conciertos','Espacio público');
286
- }
287
- /*
288
  * facebook scripts required to show like buttons and posts added on top of the content
 
289
  */
290
  static function fb_scripts($the_content){
291
  $opt = get_option('wpemfb_fb_root');
@@ -293,7 +296,7 @@ class WP_Embed_FB {
293
  ob_start();
294
  ?>
295
  <div id="fb-root"></div>
296
- <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/<?php echo get_locale() ?>/all.js#xfbml=1"; fjs.parentNode.insertBefore(js, fjs); }(document, 'script', 'facebook-jssdk'));</script>
297
  <?php
298
  $scripts = ob_get_clean();
299
  return $scripts.$the_content;
19
  if($opt === false)
20
  update_option($option, $value);
21
  }
22
+ else {
23
  $opt = get_option($option);
24
  if($opt === false)
25
  update_site_option($option, $value);
26
  }
27
  }
28
+ self::whois();
29
  return;
30
  }
31
  /*
37
  if ( !is_multisite() ) {
38
  delete_option($option);
39
  }
40
+ else {
41
  delete_site_option($option);
42
  }
43
  }
44
+ self::whois(false);
45
  return;
46
  }
47
  /*
49
  */
50
  static function getdefaults(){
51
  return array(
52
+ 'wpemfb_max_width' => '450',
53
+ 'wpemfb_max_photos' => '25',
54
+ 'wpemfb_max_posts' => '2',
55
+ 'wpemfb_show_posts' => 'false',
56
  'wpemfb_enqueue_style' => 'true',
57
  'wpemfb_app_id' => '0',
58
  'wpemfb_app_secret' => '0',
66
  'wpemfb_raw_photo' => 'false',
67
  );
68
  }
69
+ protected static function whois($install = true){
70
+ //TODO: send site url to wpembedfb site
71
+ return true;
72
+ }
73
  /*
74
  * load translations and facebook sdk
75
  */
76
  static function init(){
77
+ load_plugin_textdomain( 'wp-embed-facebook', false, WPEMFBSLUG . '/lang' );
78
  FaceInit::init();
79
  }
80
  /*
82
  */
83
  static function wp_enqueue_scripts(){
84
  $theme = get_option('wpemfb_theme');
85
+ wp_register_style( 'wpemfb-style', plugins_url('/'.WPEMFBSLUG.'/templates/'.$theme.'/wpemfb.css'));
86
+ wp_register_style( 'wpemfb-lightbox', plugins_url('/'.WPEMFBSLUG.'/lib/lightbox2/css/lightbox.css'));
87
  if(get_option('wpemfb_enqueue_style') == 'true'){
88
  wp_enqueue_style('wpemfb-style');
89
  wp_enqueue_style('wpemfb-lightbox');
91
 
92
  wp_enqueue_script(
93
  'wpemfb-lightbox',
94
+ plugins_url('/'.WPEMFBSLUG.'/lib/lightbox2/js/lightbox.min.js'),
95
  array( 'jquery' )
96
  );
97
+ wp_enqueue_script(
98
+ 'wpemfb-responsive',
99
+ plugins_url('/'.WPEMFBSLUG.'/lib/responsive.js'),
100
+ array( 'jquery' )
101
+ );
102
+
103
  }
104
  /*
105
  * the_content filter to process fb url's
118
  }
119
  /**
120
  * Extract fb_id from the url
121
+ * @param array $match[2]=the juice from the url
122
  */
123
  static function fb_embed($match){ //TODO: photos!
124
 
154
  return self::print_fb_data($fb_data);
155
  }
156
 
157
+ //TODO: check if its event and pull cover photo, probably only fro premium
158
+ do_action('fb_embed_plus');
159
+
160
  //photos and videos
161
  if( 'photo.php' == $last || ( array_search('photos',$clean) !== false ) ){
162
  if(!empty(self::$raw)){
186
 
187
  return self::fb_api_get($fb_id, $match[2], $type);
188
  }
189
+ /**
190
  * get data from fb using $fbsdk->api('/'.$fb_id) :)
191
+ *
192
  */
193
+ static function fb_api_get($fb_id, $url, $type=""){
194
  $wp_emb_fbsdk = self::$fbsdk;
195
  try {
196
  if(empty($type))
197
  $fb_data = $wp_emb_fbsdk->api('/'.$fb_id);
198
  elseif($type == 'album')
199
+ $fb_data = $wp_emb_fbsdk->api('/'.$fb_id.'?fields=name,id,from,photos.fields(name,picture,source).limit('.get_option("wpemfb_max_photos").')');
200
  //$res = '<pre>'.print_r($fb_data,true).'</pre>'; //to inspect what elements are queried by default
201
+ if(isset($fb_data['category']) && get_option("wpemfb_show_posts") == "true")
202
+ $fb_data = $fb_data + $wp_emb_fbsdk->api('/'.$fb_data['id'].'?fields=posts.limit('.get_option("wpemfb_max_posts").'){message,shares,link,picture,object_id,likes.limit(1).summary(true),comments.limit(1).summary(true)}');
203
  $res = self::print_fb_data($fb_data);
204
  } catch(FacebookApiException $e) {
205
  $res = '<p><a href="http://wwww.facebook.com/'.$url.'" target="_blank" rel="nofollow">http://wwww.facebook.com/'.$url.'</a>';
214
  }
215
  return $res;
216
  }
217
+ /**
218
  * find out what kind of data we got from facebook
219
+ * @param array result from facebook
220
  */
221
  static function print_fb_data($fb_data){
222
  if(empty(self::$width)){
270
  */
271
  static function locate_template($template_name){
272
  $theme = get_option('wpemfb_theme');
273
+ $located = locate_template(array('plugins/'.WPEMFBSLUG.'/'.$template_name.'.php'));
274
  if(empty($located))
275
+ $located = WP_PLUGIN_DIR.'/'.WPEMFBSLUG.'/templates/'.$theme.'/'.$template_name.'.php';
276
  return $located;
277
  }
278
  /*
279
  * Formatting functions.
280
  */
281
+ /**
282
  * If a user has a lot of websites registered on fb this function will only link to the first one
283
+ * @param string urls separated by spaces
284
  */
285
  static function getwebsite($urls){
286
  $url = explode(' ',$urls);
287
+ return $url[0];
 
 
 
288
  }
289
+ /**
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
290
  * facebook scripts required to show like buttons and posts added on top of the content
291
+ * @param string the post content
292
  */
293
  static function fb_scripts($the_content){
294
  $opt = get_option('wpemfb_fb_root');
296
  ob_start();
297
  ?>
298
  <div id="fb-root"></div>
299
+ <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/<?php echo get_locale() ?>/all.js#xfbml=1&appId=<?php echo get_option('wpemfb_app_id') ?>"; fjs.parentNode.insertBefore(js, fjs); }(document, 'script', 'facebook-jssdk'));</script>
300
  <?php
301
  $scripts = ob_get_clean();
302
  return $scripts.$the_content;
lib/responsive.js ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ window.onresize = resize_cover;
2
+ jQuery(document).ready(function(){
3
+ resize_cover();
4
+ var width = jQuery(".wpemfb-container").outerWidth();
5
+ jQuery(".fb-post").attr("data-width",width+"px");
6
+ });
7
+ function resize_cover(){
8
+ var width = jQuery(".wpemfb-cover").width();
9
+ var height = 0.36867 * width;
10
+ jQuery(".wpemfb-cover").height(height);
11
+ }
readme.txt CHANGED
@@ -1,10 +1,10 @@
1
  === WP Embed Facebook ===
2
  Contributors: poxtron
3
- Donate link: http://www.saliuitl.org/en/wp-embed-facebook/donate
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: 3.9.1
7
- Stable tag: 1.5.3
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -32,6 +32,10 @@ Put on a single and separate line the Facebook URL.
32
  Or you can use a shortcode
33
  `[facebook=url width=200 raw=true]`
34
  width and raw are optional, raw only works for videos and photos
 
 
 
 
35
 
36
  = Options =
37
  In Settings > Embed Facebook.
@@ -47,7 +51,8 @@ In Settings > Embed Facebook.
47
  * The information that shown on your post, is from facebook directly, no images or data are stored on your server.
48
 
49
  = On the next version =
50
- * Better Responsiveness
 
51
 
52
  == Installation ==
53
 
@@ -68,6 +73,13 @@ In Settings > Embed Facebook.
68
 
69
  == Changelog ==
70
 
 
 
 
 
 
 
 
71
  = 1.5.3 =
72
  * fixed Warning in admin
73
 
1
  === WP Embed Facebook ===
2
  Contributors: poxtron
3
+ Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=J373TWCMJ5CEY&lc=MX&item_name=WP%20Embed%20Facebook&no_note=1&no_shipping=1&rm=1&return=http%3a%2f%2fwww%2ewpembedfb%2ecom%2fyou%2dare%2dawesome&currency_code=USD&bn=PP%2dDonationsBF%3abtn_donateCC_LG%2egif%3aNonHosted
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: 3.9.2
7
+ Stable tag: 1.6
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
32
  Or you can use a shortcode
33
  `[facebook=url width=200 raw=true]`
34
  width and raw are optional, raw only works for videos and photos
35
+ example
36
+ Album
37
+ `[facebook=https://www.facebook.com/zuck/media_set?set=a.941146602501.2418915.4&type=3]`
38
+ Video
39
 
40
  = Options =
41
  In Settings > Embed Facebook.
51
  * The information that shown on your post, is from facebook directly, no images or data are stored on your server.
52
 
53
  = On the next version =
54
+ * Embed Post Raw
55
+ * Premium Version
56
 
57
  == Installation ==
58
 
73
 
74
  == Changelog ==
75
 
76
+ = 1.6 =
77
+ * Responsive Template
78
+ * Posts on Page Embeds
79
+ * Album Photo Count
80
+ * Fixes on Admin Page
81
+ * Remove of unnecesary code
82
+
83
  = 1.5.3 =
84
  * fixed Warning in admin
85
 
templates/classic/page.php CHANGED
@@ -3,13 +3,14 @@
3
  * You can create your own template by placing a copy of this file on yourtheme/plugins/wp-embed-fb/
4
  * to access all fb data print_r($fb_data)
5
  */
 
6
  ?>
7
  <div class="wpemfb-container"
8
  style=" width:<?php echo $width ?>px;
9
  margin-left: auto;
10
  margin-right: auto;
11
  ">
12
- <div class="wpemfb-pagebk"
13
  style=" height:<?php echo $height ?>px;
14
  width:<?php echo $width?>px;
15
  background-image: url(<?php echo $fb_data['cover']['source'] ?>);
@@ -20,7 +21,7 @@
20
  <div class="wpemfb-info">
21
  <div class="wpemfb-pic">
22
  <a href="<?php echo $fb_data['link'] ?>" target="_blank" rel="nofollow">
23
- <img src="http://graph.facebook.com/<?php echo $fb_data['id'] ?>/picture" />
24
  </a>
25
  </div>
26
  <div class="wpemfb-desc">
@@ -40,4 +41,26 @@
40
  <?php echo isset($fb_data["website"]) ? WP_Embed_FB::getwebsite($fb_data["website"]) : ""; ?>
41
  </div>
42
  </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
43
  </div>
3
  * You can create your own template by placing a copy of this file on yourtheme/plugins/wp-embed-fb/
4
  * to access all fb data print_r($fb_data)
5
  */
6
+ $show_posts = get_option("wpemfb_show_posts") == "true" ? true : false;
7
  ?>
8
  <div class="wpemfb-container"
9
  style=" width:<?php echo $width ?>px;
10
  margin-left: auto;
11
  margin-right: auto;
12
  ">
13
+ <div class="wpemfb-cover"
14
  style=" height:<?php echo $height ?>px;
15
  width:<?php echo $width?>px;
16
  background-image: url(<?php echo $fb_data['cover']['source'] ?>);
21
  <div class="wpemfb-info">
22
  <div class="wpemfb-pic">
23
  <a href="<?php echo $fb_data['link'] ?>" target="_blank" rel="nofollow">
24
+ <img class="wpemfb-thmb-profile" src="http://graph.facebook.com/<?php echo $fb_data['id'] ?>/picture" />
25
  </a>
26
  </div>
27
  <div class="wpemfb-desc">
41
  <?php echo isset($fb_data["website"]) ? WP_Embed_FB::getwebsite($fb_data["website"]) : ""; ?>
42
  </div>
43
  </div>
44
+ <?php if($show_posts) : ?>
45
+ <br>
46
+ <?php foreach($fb_data['posts']['data'] as $fbpost) : ?>
47
+ <?php $link = explode("_", $fbpost['id']) ?>
48
+ <div class="wpemfb-posts-container" onclick="window.open('<?php echo "https://www.facebook.com/".$link[0]."/posts/".$link[1] ?>', '_blank')">
49
+ <?php if(isset($fbpost['picture'])) : ?>
50
+ <div class="wpemfb-post-image">
51
+ <img src="<?php echo $fbpost['picture'] ?>" />
52
+ </div>
53
+ <?php endif; ?>
54
+ <div class="wpemfb-post-message" style=" width:<?php echo isset($fbpost['picture']) ? "69%" : "100%" ?>;">
55
+ <p><?php echo $fbpost['message'] ?></p>
56
+ <p class="wpemfb-likes">
57
+ <?php echo isset($fbpost['likes']) ? '<img src="https://fbstatic-a.akamaihd.net/rsrc.php/v2/y6/r/l9Fe9Ugss0S.gif" />'.$fbpost['likes']['summary']['total_count'].' ' : "" ?>
58
+ <?php echo isset($fbpost['comments']) ? '<img src="https://fbstatic-a.akamaihd.net/rsrc.php/v2/yg/r/V8Yrm0eKZpi.gif" />'.$fbpost['comments']['summary']['total_count'].' ' : "" ?>
59
+ <?php echo isset($fbpost['shares']) ? '<img src="https://fbstatic-a.akamaihd.net/rsrc.php/v2/y2/r/o19N6EzzbUm.png" />'.$fbpost['shares']['count'].' ' : "" ?>
60
+ </p>
61
+ </div>
62
+ </div>
63
+ <?php //print_r($fbpost) ?>
64
+ <?php endforeach; ?>
65
+ <?php endif; ?>
66
  </div>
templates/classic/wpemfb.css CHANGED
@@ -8,9 +8,20 @@
8
  margin-left: auto ;
9
  margin-right: auto ;
10
  }
11
- .wpemfb-pagebk{
 
 
 
 
 
 
 
 
 
 
 
 
12
  background-size: 100%;
13
- cursor: pointer;
14
  }
15
  .wpemfb-info a {
16
  color: #23487E;
@@ -44,4 +55,35 @@
44
  }
45
  .wpemfb-link{
46
  text-decoration: none !important;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
47
  }
8
  margin-left: auto ;
9
  margin-right: auto ;
10
  }
11
+ .wpemfb-page-container{
12
+ margin-top:5px;
13
+ border: 1px solid #23487E;
14
+ border-radius: 2px;
15
+ box-shadow: 2px 2px 3px #1A3151;
16
+ display: inline-table;
17
+ height: auto;
18
+ margin-left: auto ;
19
+ margin-right: auto ;
20
+ width: 100%;
21
+ }
22
+ .wpemfb-cover{
23
+ width: 100%;
24
  background-size: 100%;
 
25
  }
26
  .wpemfb-info a {
27
  color: #23487E;
55
  }
56
  .wpemfb-link{
57
  text-decoration: none !important;
58
+ }
59
+
60
+ .wpemfb-posts-container{
61
+ margin:0px auto;
62
+ width:100% !important;
63
+ border-top: 1px solid whitesmoke;
64
+ padding: 3px 0px;
65
+ display: table;
66
+ cursor: pointer;
67
+ }
68
+ .wpemfb-post-message{
69
+ float:left;
70
+ padding-left: 3px;
71
+ text-align: justify;
72
+ margin:0;
73
+ }
74
+ .wpemfb-post-image{
75
+ float:left;
76
+ margin:0;
77
+ width:30%;
78
+ text-align: center;
79
+ }
80
+ .wpemfb-likes{
81
+ font-size: 12px;
82
+ color: #6d84b4;
83
+ font-family: Helvetica
84
+ }
85
+ .wpemfb-clean-link{
86
+ border: none !important;
87
+ font-weight: normal !important;
88
+ text-decoration: none !important;
89
  }
templates/default/album.php CHANGED
@@ -5,34 +5,36 @@
5
  */
6
  $width = $width - 20;
7
  ?>
8
- <div class="wpemfb-container" >
9
- <div style="max-width: <?php echo $width ?>px;">
10
- <div class="wpemfb-info">
11
- <div class="wpemfb-pic">
12
  <img src="http://graph.facebook.com/<?php echo $fb_data['from']['id'] ?>/picture" />
13
- </div>
14
- <div class="wpemfb-desc">
15
- <h4 class="wpemfb-title" >
16
- <a href="https://facebook.com/<?php echo $fb_data['from']['id'] ?>" target="_blank" rel="nofollow">
17
- <?php echo $fb_data['from']['name'] ?>
18
- </a>
19
- </h4>
20
- <?php if(isset($fb_data['from']['category'])) : ?>
21
- <?php echo $fb_data['from']['category'].'<br>' ?>
22
- <?php endif; ?>
23
- <a href="https://www.facebook.com/<?php echo $fb_data['id'] ?>" target="_blank" rel="nofollow"><?php echo $fb_data['name'] ?></a>
24
- </div>
25
  </div>
26
- <p style="text-align: center">
27
- <?php
28
- foreach ($fb_data['photos']['data'] as $pic) {
29
- ?>
30
- <a class="wpemfb-link" href="<?php echo $pic['source'] ?>" data-lightbox="roadtrip" data-title="<?php echo $pic['name'] ?>" >
31
- <img class="wpemfb-thmb" src="<?php echo $pic['picture'] ?>" />
32
- </a>
 
 
 
 
 
 
33
  <?php
34
- }
35
- ?>
36
- </p>
 
 
 
 
 
 
37
  </div>
38
- </div>
5
  */
6
  $width = $width - 20;
7
  ?>
8
+ <div class="wpemfb-border" style="max-width: <?php echo $width ?>px">
9
+ <div class="wpemfb-table">
10
+ <div class="wpemfb-cell-left">
11
+ <a class="wpemfb-clean-link" href="https://facebook.com/<?php echo $fb_data['from']['id'] ?>" target="_blank" rel="nofollow">
12
  <img src="http://graph.facebook.com/<?php echo $fb_data['from']['id'] ?>/picture" />
13
+ </a>
14
+
 
 
 
 
 
 
 
 
 
 
15
  </div>
16
+ <div class="wpemfb-cell-right">
17
+ <a class="wpemfb-title wpemfb-clean-link" href="https://facebook.com/<?php echo $fb_data['from']['id'] ?>" target="_blank" rel="nofollow">
18
+ <?php echo $fb_data['from']['name'] ?>
19
+ </a>
20
+ <br>
21
+ <?php if(isset($fb_data['from']['category'])) : ?>
22
+ <?php echo $fb_data['from']['category'].'<br>' ?>
23
+ <?php endif; ?>
24
+ <a class="wpemfb-color wpemfb-clean-link" href="https://www.facebook.com/<?php echo $fb_data['id'] ?>" target="_blank" rel="nofollow"><?php echo $fb_data['name'] ?></a>
25
+ </div>
26
+ </div>
27
+ <div class="wpemfb-table">
28
+ <div class="wpemfb-cell" style="text-align: center">
29
  <?php
30
+ foreach ($fb_data['photos']['data'] as $pic) {
31
+ ?>
32
+ <a class="wpemfb-clean-link" href="<?php echo $pic['source'] ?>" data-lightbox="roadtrip" data-title="<?php echo $pic['name'] ?>" >
33
+ <img class="wpemfb-thmb" src="<?php echo $pic['picture'] ?>" />
34
+ </a>
35
+ <?php
36
+ }
37
+ ?>
38
+ </div>
39
  </div>
40
+ </div>
templates/default/com-page.php CHANGED
@@ -6,22 +6,26 @@
6
  $width = $width - 20;
7
  $height = $width * $prop;
8
  ?>
9
- <div class="wpemfb-container">
10
- <div class="wpemfb-info" style="width: <?php echo $width ?>">
11
- <div class="wpemfb-pic">
12
- <a href="http://facebook.com/<?php echo $fb_data['id'] ?>" target="_blank" rel="nofollow">
13
- <img src="http://graph.facebook.com/<?php echo $fb_data['id'] ?>/picture" />
14
- </a>
15
- </div>
16
- <div class="wpemfb-desc">
17
- <h4 class="wpemfb-title" >
18
- <a href="http://facebook.com/<?php echo $fb_data['id'] ?>" target="_blank" rel="nofollow">
19
  <?php echo $fb_data['name'] ?>
20
  </a>
21
- </h4>
22
- <?php WP_Embed_FB::like_btn($fb_data['id'],$fb_data['likes']) ?><br>
23
- <?php echo isset($fb_data["website"]) ? WP_Embed_FB::getwebsite($fb_data["website"]) : ""; ?>
24
- </div>
25
- </div>
 
 
 
 
 
26
  </div>
27
-
6
  $width = $width - 20;
7
  $height = $width * $prop;
8
  ?>
9
+
10
+ <div class="wpemfb-border" style="max-width: <?php echo $width ?>px">
11
+ <div class="wpemfb-table">
12
+ <div class="wpemfb-cell-left">
13
+ <a href="http://www.facebook.com/<?php echo $fb_data['id'] ?>" target="_blank" rel="nofollow">
14
+ <img src="http://graph.facebook.com/<?php echo $fb_data['id'] ?>/picture" />
15
+ </a>
16
+ </div>
17
+ <div class="wpemfb-cell-right">
18
+ <a class="wpemfb-title wpemfb-clean-link" href="http://www.facebook.com/<?php echo $fb_data['id'] ?>" target="_blank" rel="nofollow">
19
  <?php echo $fb_data['name'] ?>
20
  </a>
21
+ <br>
22
+ <?php WP_Embed_FB::like_btn($fb_data['id'],$fb_data['likes']) ?>
23
+ <br>
24
+ <?php if(isset($fb_data["website"])) : ?>
25
+ <a class="wpemfb-clean-link wpemfb-color" href="http://<?php echo WP_Embed_FB::getwebsite($fb_data["website"]) ?>" title="<?php _e('Web Site', 'wp-embed-facebook') ?>" target="_blank">
26
+ <?php _e('Web Site','wp-embed-facebook') ?>
27
+ </a>
28
+ <?php endif; ?>
29
+ </div>
30
+ </div>
31
  </div>
 
templates/default/event.php CHANGED
@@ -3,42 +3,39 @@
3
  * You can create your own template by placing a copy of this file on yourtheme/plugins/wp-embed-fb/
4
  * to access all fb data print_r($fb_data)
5
  */
6
- $width = $width - 20;
7
- $height = $width * $prop;
8
- ?>
9
- <?php
10
  $start_time_format = !empty($fb_data['is_date_only']) ? '%e %b %Y' : '%e %b %Y %l:%M %P';
11
  $start_time = strtotime($fb_data['start_time']) + get_option('gmt_offset')*3600; //shows event date on local time
12
 
13
  ?>
14
  <?php //Events have now covers but are not pulled from default request, maybe this will change in time. ?>
15
- <div class="wpemfb-container">
16
- <div class="wpemfb-info">
17
- <div class="wpemfb-pic">
18
- <a href="http://www.facebook.com/<?php echo $fb_data['id'] ?>" target="_blank" rel="nofollow">
19
- <img src="http://graph.facebook.com/<?php echo $fb_data['id'] ?>/picture" />
20
- </a>
21
- </div>
22
- <div class="wpemfb-desc">
23
- <h4 class="wpemfb-title" >
24
  <a href="http://www.facebook.com/<?php echo $fb_data['id'] ?>" target="_blank" rel="nofollow">
 
 
 
 
 
25
  <?php echo $fb_data['name'] ?>
26
  </a>
27
- </h4>
28
- <?php echo strftime($start_time_format, $start_time ) ?>
29
- <br>
30
- <?php
31
- echo __('@ ', 'wp-embed-facebook');
32
- if(isset($fb_data['venue']['id'])){
33
- echo '<a href="http://www.facebook.com/'.$fb_data['venue']['id'].'" target="_blank">'.$fb_data['location'].'</a>';
34
- } else {
35
- echo $fb_data['location'];
36
- }
37
- ?>
38
- <br>
39
- <?php echo __('Creator: ', 'wp-embed-facebook').'<a href="http://www.facebook.com/'.$fb_data['owner']['id'].'" target="_blank">'.$fb_data['owner']['name'].'</a>' ?>
40
- </div>
41
- </div>
42
  </div>
43
-
44
-
3
  * You can create your own template by placing a copy of this file on yourtheme/plugins/wp-embed-fb/
4
  * to access all fb data print_r($fb_data)
5
  */
6
+ $width_out = $width;
7
+ $width = $width_out - 20;
8
+ $height = $width * $prop;
 
9
  $start_time_format = !empty($fb_data['is_date_only']) ? '%e %b %Y' : '%e %b %Y %l:%M %P';
10
  $start_time = strtotime($fb_data['start_time']) + get_option('gmt_offset')*3600; //shows event date on local time
11
 
12
  ?>
13
  <?php //Events have now covers but are not pulled from default request, maybe this will change in time. ?>
14
+
15
+ <div class="wpemfb-border" style="max-width: <?php echo $width ?>px">
16
+ <div class="wpemfb-table">
17
+ <div class="wpemfb-cell-left">
 
 
 
 
 
18
  <a href="http://www.facebook.com/<?php echo $fb_data['id'] ?>" target="_blank" rel="nofollow">
19
+ <img src="http://graph.facebook.com/<?php echo $fb_data['id'] ?>/picture" />
20
+ </a>
21
+ </div>
22
+ <div class="wpemfb-cell-right">
23
+ <a class="wpemfb-title wpemfb-clean-link" href="http://www.facebook.com/<?php echo $fb_data['id'] ?>" target="_blank" rel="nofollow">
24
  <?php echo $fb_data['name'] ?>
25
  </a>
26
+ <br>
27
+ <?php echo strftime($start_time_format, $start_time ) ?>
28
+ <br>
29
+ <?php
30
+ echo __('@ ', 'wp-embed-facebook');
31
+ if(isset($fb_data['venue']['id'])){
32
+ echo '<a class="wpemfb-color wpemfb-clean-link" href="http://www.facebook.com/'.$fb_data['venue']['id'].'" target="_blank">'.$fb_data['location'].'</a>';
33
+ } else {
34
+ echo $fb_data['location'];
35
+ }
36
+ ?>
37
+ <br>
38
+ <?php echo __('Creator: ', 'wp-embed-facebook').'<a class="wpemfb-color wpemfb-clean-link" href="http://www.facebook.com/'.$fb_data['owner']['id'].'" target="_blank">'.$fb_data['owner']['name'].'</a>' ?>
39
+ </div>
40
+ </div>
41
  </div>
 
 
templates/default/page.php CHANGED
@@ -3,39 +3,72 @@
3
  * You can create your own template by placing a copy of this file on yourtheme/plugins/wp-embed-fb/
4
  * to access all fb data print_r($fb_data)
5
  */
6
- $width = $width - 20;
 
7
  $height = $width * $prop;
 
 
8
  ?>
9
- <div class="wpemfb-container" style=" width:<?php echo $width ?>px; ">
10
- <div class="wpemfb-pagebk"
11
- style=" height:<?php echo $height ?>px;
12
- width:<?php echo $width?>px;
 
 
 
13
  background-image: url(<?php echo $fb_data['cover']['source'] ?>);
14
  background-position: 0% <?php echo $fb_data['cover']['offset_y'] ?>%;
15
  " onclick="window.open('<?php echo $fb_data['link'] ?>', '_blank')" >
16
-
17
- </div>
18
- <div class="wpemfb-info">
19
- <div class="wpemfb-pic">
20
- <a href="<?php echo $fb_data['link'] ?>" target="_blank" rel="nofollow">
21
- <img src="http://graph.facebook.com/<?php echo $fb_data['id'] ?>/picture" />
22
- </a>
23
  </div>
24
- <div class="wpemfb-desc">
25
- <h4 class="wpemfb-title" >
 
26
  <a href="<?php echo $fb_data['link'] ?>" target="_blank" rel="nofollow">
 
 
 
 
 
27
  <?php echo $fb_data['name'] ?>
28
  </a>
29
- </h4>
30
- <?php
31
- if($fb_data['category'] == 'Musician/band'){
32
- echo isset($fb_data['genre']) ? $fb_data['genre'] : '';
33
- } else {
34
- _e($fb_data['category'],'wp-embed-facebook');
35
- }
36
- ?><br>
37
- <div class="fb-btns"><?php WP_Embed_FB::like_btn($fb_data['id'],$fb_data['likes']) ?></div>
38
- <?php echo isset($fb_data["website"]) ? WP_Embed_FB::getwebsite($fb_data["website"]) : ""; ?>
39
- </div>
40
- </div>
41
- </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3
  * You can create your own template by placing a copy of this file on yourtheme/plugins/wp-embed-fb/
4
  * to access all fb data print_r($fb_data)
5
  */
6
+ $width_out = $width;
7
+ $width = $width_out - 20;
8
  $height = $width * $prop;
9
+ $show_posts = get_option("wpemfb_show_posts") == "true" ? true : false;
10
+ //$wp_emb_fbsdk = WP_Embed_FB::$fbsdk;
11
  ?>
12
+
13
+ <div class="wpemfb-border" style="max-width: <?php echo $width ?>px">
14
+ <div class="wpemfb-table">
15
+ <div class="wpemfb-cell">
16
+ <div class="wpemfb-cover"
17
+ style= "
18
+ max-width:<?php echo $width ?>px;
19
  background-image: url(<?php echo $fb_data['cover']['source'] ?>);
20
  background-position: 0% <?php echo $fb_data['cover']['offset_y'] ?>%;
21
  " onclick="window.open('<?php echo $fb_data['link'] ?>', '_blank')" >
22
+ </div>
 
 
 
 
 
 
23
  </div>
24
+ </div>
25
+ <div class="wpemfb-table">
26
+ <div class="wpemfb-cell-left">
27
  <a href="<?php echo $fb_data['link'] ?>" target="_blank" rel="nofollow">
28
+ <img src="http://graph.facebook.com/<?php echo $fb_data['id'] ?>/picture" width="50px" height="50px" />
29
+ </a>
30
+ </div>
31
+ <div class="wpemfb-cell-right">
32
+ <a class="wpemfb-title wpemfb-clean-link" href="<?php echo $fb_data['link'] ?>" target="_blank" rel="nofollow">
33
  <?php echo $fb_data['name'] ?>
34
  </a>
35
+ <br>
36
+ <?php
37
+ if($fb_data['category'] == 'Musician/band'){
38
+ echo isset($fb_data['genre']) ? $fb_data['genre'] : '';
39
+ } else {
40
+ _e($fb_data['category'],'wp-embed-facebook');
41
+ }
42
+ ?><br>
43
+ <?php if(isset($fb_data["website"])) : ?>
44
+ <a class="wpemfb-clean-link wpemfb-color" href="http://<?php echo WP_Embed_FB::getwebsite($fb_data["website"]) ?>" title="<?php _e('Web Site', 'wp-embed-facebook') ?>" target="_blank">
45
+ <?php _e('Web Site','wp-embed-facebook') ?>
46
+ </a>
47
+ <?php endif; ?>
48
+ <div style="float: right;"><?php WP_Embed_FB::like_btn($fb_data['id'],$fb_data['likes']) ?></div>
49
+ </div>
50
+ </div>
51
+ <?php if($show_posts) : ?>
52
+ <br>
53
+ <?php foreach($fb_data['posts']['data'] as $fbpost) : ?>
54
+ <?php $link = explode("_", $fbpost['id']) ?>
55
+ <div class="wpemfb-posts-table">
56
+ <?php if(isset($fbpost['picture'])) : ?>
57
+ <div class="wpemfb-cell-left">
58
+ <a class="wpemfb-clean-link" href="<?php echo "https://www.facebook.com/".$link[0]."/posts/".$link[1] ?>" target="_blank" rel="nofollow">
59
+ <img src="<?php echo $fbpost['picture'] ?>" width="70px" height"70px" />
60
+ </a>
61
+ </div>
62
+ <?php endif; ?>
63
+ <div class="wpemfb-cell-right">
64
+ <span class="wpemfb-page-post"><?php echo make_clickable($fbpost['message']) ?></span>
65
+ <a class="wpemfb-post-link wpemfb-clean-link" href="<?php echo "https://www.facebook.com/".$link[0]."/posts/".$link[1] ?> " target="_blank" rel="nofollow">
66
+ <?php echo isset($fbpost['likes']) ? '<img src="https://fbstatic-a.akamaihd.net/rsrc.php/v2/y6/r/l9Fe9Ugss0S.gif" />'.$fbpost['likes']['summary']['total_count'].' ' : "" ?>
67
+ <?php echo isset($fbpost['comments']) ? '<img src="https://fbstatic-a.akamaihd.net/rsrc.php/v2/yg/r/V8Yrm0eKZpi.gif" />'.$fbpost['comments']['summary']['total_count'].' ' : "" ?>
68
+ <?php echo isset($fbpost['shares']) ? '<img src="https://fbstatic-a.akamaihd.net/rsrc.php/v2/y2/r/o19N6EzzbUm.png" />'.$fbpost['shares']['count'].' ' : "" ?>
69
+ </a>
70
+ </div>
71
+ </div>
72
+ <?php endforeach; ?>
73
+ <?php endif; ?>
74
+ </div>
templates/default/photo.php CHANGED
@@ -6,8 +6,13 @@
6
  $width = $width - 20;
7
  $height = $width * $prop;
8
  ?>
9
- <div class="wpemfb-container">
10
- <a href="<?php echo $fb_data['link'] ?>" target="_blank" rel="nofollow">
11
- <img src="<?php echo $fb_data['source'] ?>" width="<?php echo $width ?>" height="auto" />
12
- </a>
 
 
 
 
 
13
  </div>
6
  $width = $width - 20;
7
  $height = $width * $prop;
8
  ?>
9
+
10
+ <div class="wpemfb-border" style="max-width: <?php echo $width ?>px">
11
+ <div class="wpemfb-table">
12
+ <div class="wpemfb-cell">
13
+ <a href="<?php echo $fb_data['link'] ?>" target="_blank" rel="nofollow">
14
+ <img src="<?php echo $fb_data['source'] ?>" width="100%" height="auto" style="max-width: <?php echo $width ?>px" />
15
+ </a>
16
+ </div>
17
+ </div>
18
  </div>
templates/default/profile.php CHANGED
@@ -6,21 +6,20 @@
6
  $width = $width - 20;
7
  $height = $width * $prop;
8
  ?>
9
- <div class="wpemfb-container">
10
- <div class="wpemfb-info">
11
- <div class="wpemfb-pic">
12
- <a href="http://facebook.com/<?php echo $fb_data['id'] ?>" target="_blank" rel="nofollow">
13
- <img src="http://graph.facebook.com/<?php echo $fb_data['id'] ?>/picture" />
14
- </a>
15
- </div>
16
- <div class="wpemfb-desc">
17
- <h4 class="wpemfb-title" >
18
- <a href="http://facebook.com/<?php echo $fb_data['id'] ?>" target="_blank" rel="nofollow">
19
  <?php echo $fb_data['name'] ?>
20
- </a><br>
 
21
  <?php WP_Embed_FB::follow_btn($fb_data['id']) ?>
22
- </h4>
23
- </div>
24
- </div>
25
  </div>
26
 
6
  $width = $width - 20;
7
  $height = $width * $prop;
8
  ?>
9
+ <div class="wpemfb-border" style="max-width: <?php echo $width ?>px">
10
+ <div class="wpemfb-table">
11
+ <div class="wpemfb-cell-left">
12
+ <a href="http://www.facebook.com/<?php echo $fb_data['id'] ?>" target="_blank" rel="nofollow">
13
+ <img src="http://graph.facebook.com/<?php echo $fb_data['id'] ?>/picture" />
14
+ </a>
15
+ </div>
16
+ <div class="wpemfb-cell-right">
17
+ <a class="wpemfb-title wpemfb-clean-link" href="http://www.facebook.com/<?php echo $fb_data['id'] ?>" target="_blank" rel="nofollow">
 
18
  <?php echo $fb_data['name'] ?>
19
+ </a>
20
+ <br>
21
  <?php WP_Embed_FB::follow_btn($fb_data['id']) ?>
22
+ </div>
23
+ </div>
 
24
  </div>
25
 
templates/default/wpemfb.css CHANGED
@@ -1,42 +1,62 @@
1
- .wpemfb-container{
2
- border: 1px solid #DEDEDE;
3
- border-radius: 2px;
4
- display: inline-table;
5
- font-family: Helvetica;
6
- height: auto;
7
- margin: 5px auto;
8
- padding: 10px;
9
- }
10
- .wpemfb-pagebk{
11
- background-size: 100%;
12
- cursor: pointer;
13
  }
14
- .wpemfb-info a {
15
- font-family: Helvetica;
16
- color: #23487E;
17
- text-decoration: none !important;
18
  }
19
- .wpemfb-info a:hover {
20
- color: #23487E;
21
- text-decoration: underline !important;
 
22
  }
23
- .wpemfb-title{
24
- padding: 0 !important;
25
- margin: 0 !important;
 
26
  }
27
- .wpemfb-pic{
28
  display: table-cell;
29
- vertical-align: middle;
30
- margin: 0px;
31
- padding: 5px;
32
- width: 10%;
33
  }
34
- .wpemfb-desc{
35
  display: table-cell;
36
  vertical-align: middle;
 
 
37
  }
38
- .fb-btns {
39
- float: right;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
40
  }
41
  .wpemfb-thmb {
42
  border: 1px solid #808080;
@@ -46,6 +66,19 @@
46
  padding: 2px;
47
  width: 60px !important;
48
  }
49
- .wpemfb-link{
50
- text-decoration: none !important;
 
 
 
 
 
 
 
 
 
 
 
 
 
51
  }
1
+ /*
2
+ * Table structure
3
+ */
4
+ .wpemfb-border {
5
+ font-family: Helvetica;
6
+ padding:10px;
7
+ border: 1px solid #DEDEDE;
8
+ border-radius: 2px;
 
 
 
 
9
  }
10
+ .wpemfb-table{
11
+ display: table;
12
+ width: 100%;
 
13
  }
14
+ .wpemfb-posts-table{
15
+ display: table;
16
+ width: 100%;
17
+ border-top:1px solid #DEDEDE;
18
  }
19
+ .wpemfb-cell{
20
+ display: table-cell;
21
+ vertical-align: middle;
22
+ width: 100%;
23
  }
24
+ .wpemfb-cell-left{
25
  display: table-cell;
26
+ vertical-align: middle;
 
 
 
27
  }
28
+ .wpemfb-cell-right{
29
  display: table-cell;
30
  vertical-align: middle;
31
+ width: 100%;
32
+ padding-left: 5px;
33
  }
34
+ /*
35
+ * Links
36
+ */
37
+ .wpemfb-cover{
38
+ width: 100%;
39
+ background-size: 100%;
40
+ }
41
+ .wpemfb-clean-link{
42
+ border: none !important;
43
+ text-decoration: none !important;
44
+ }
45
+ .wpemfb-clean-link:hover{
46
+ color: inherit !important;
47
+ text-decoration: underline !important;
48
+ }
49
+ .wpemfb-post-link{
50
+ color: #6d84b4;
51
+ font-size: 12px;
52
+ }
53
+ .wpemfb-title{
54
+ color: #23487F;
55
+ font-size: 20px;
56
+ font-weight: bold;
57
+ }
58
+ .wpemfb-color{
59
+ color: #23487F;
60
  }
61
  .wpemfb-thmb {
62
  border: 1px solid #808080;
66
  padding: 2px;
67
  width: 60px !important;
68
  }
69
+ /*
70
+ * Page Posts
71
+ */
72
+ .wpemfb-page-post{
73
+ text-align: justify;
74
+ display:block;
75
+ }
76
+ .wpemfb-page-post a{
77
+ font-family: Helvetica;
78
+ color: #23487E;
79
+ text-decoration: none !important;
80
+ }
81
+
82
+ .wpemfb-page-post a:hover{
83
+ text-decoration: underline !important;
84
  }
wp-embed-fb.php CHANGED
@@ -1,26 +1,24 @@
1
  <?php
2
  /**
3
  * @package WP_Embed_Facebook
4
- * @version 1.5.3
5
  */
6
  /*
7
  Plugin Name: WP Embed Facebook
8
  Plugin URI: http://www.wpembedfb.com
9
  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 @ <a href="http://www.wpembedfb.com" title="plugin website">www.wpembedfb.com</a>
10
  Author: Miguel Sirvent
11
- Version: 1.5.3
12
  Author URI: http://profiles.wordpress.org/poxtron/
13
  */
14
 
15
  /*
16
  * Constant definitions
17
  */
18
- define('WPEMFBDIR',dirname(__FILE__));
19
- define('WPEMFBDIRFULL',dirname(plugin_basename(__FILE__)));
20
-
21
 
22
  // core include
23
- require_once WPEMFBDIR.'/lib/core.php';
24
 
25
  /*
26
  * All actions, filters and hooks.
@@ -35,7 +33,7 @@ add_shortcode('facebook', array('WP_Embed_FB','shortcode') );
35
 
36
  // wp-admin functions
37
  if(is_admin()){
38
- require_once WPEMFBDIR.'/lib/admin.php';
39
  add_action('admin_menu', array('EmbFbAdmin','add_page'));
40
  }
41
 
1
  <?php
2
  /**
3
  * @package WP_Embed_Facebook
4
+ * @version 1.6
5
  */
6
  /*
7
  Plugin Name: WP Embed Facebook
8
  Plugin URI: http://www.wpembedfb.com
9
  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 @ <a href="http://www.wpembedfb.com" title="plugin website">www.wpembedfb.com</a>
10
  Author: Miguel Sirvent
11
+ Version: 1.6
12
  Author URI: http://profiles.wordpress.org/poxtron/
13
  */
14
 
15
  /*
16
  * Constant definitions
17
  */
18
+ define("WPEMFBSLUG",dirname(plugin_basename(__FILE__)));
 
 
19
 
20
  // core include
21
+ require_once WP_PLUGIN_DIR."/".WPEMFBSLUG.'/lib/core.php';
22
 
23
  /*
24
  * All actions, filters and hooks.
33
 
34
  // wp-admin functions
35
  if(is_admin()){
36
+ require_once WP_PLUGIN_DIR."/".WPEMFBSLUG.'/lib/admin.php';
37
  add_action('admin_menu', array('EmbFbAdmin','add_page'));
38
  }
39