WP Embed Facebook - Version 1.9.4

Version Description

  • Added option to embed raw videos with facebook code
  • Added poster on raw embed videos
  • Update to FB API v2.3
  • Update raw photo template
Download this release

Release Info

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

Code changes from version 1.9.3 to 1.9.4

lib/admin.php CHANGED
@@ -1,382 +1,283 @@
1
  <?php
2
- //TODO add option
3
- class EmbFbAdmin{
4
- static function admin_enqueue_scripts($hook_suffix){
5
- if($hook_suffix == 'settings_page_embedfacebook'){
6
- global $wp_scripts;
7
- wp_enqueue_script('wpemfb-admin', WPEMFBURL.'lib/js/admin.js',array('jquery-ui-accordion'));
8
- $queryui = $wp_scripts->query('jquery-ui-core');
9
- $url = "http://ajax.googleapis.com/ajax/libs/jqueryui/".$queryui->ver."/themes/smoothness/jquery-ui.css";
10
- wp_enqueue_style('jquery-ui-start', $url, false, null);
11
- }
12
- $translation_array = array( 'local' => get_locale(), 'fb_id'=>get_site_option('wpemfb_app_id'), 'fb_root'=>get_site_option('wpemfb_fb_root') );
13
- wp_localize_script( 'wpemfb', 'WEF', $translation_array );
 
 
 
14
  wp_enqueue_script('wpemfb');
15
- }
16
- static function admin_init(){
17
- $theme = get_site_option('wpemfb_theme');
18
- add_editor_style( WPEMFBURL.'templates/'.$theme.'/wpemfb.css' );
19
- }
20
- static function add_page(){
21
- add_options_page('EmbedFacebook', 'Embed Facebook', 'manage_options', 'embedfacebook', array('EmbFbAdmin', 'embedfb_page'));
22
- }
23
- static function savedata(){
24
- if(isset($_POST['wpemfb_app_secret'], $_POST['wpemfb_app_id' ] )) {
25
- if($_POST['wpemfb_app_id'] && $_POST['wpemfb_app_secret']){
26
- update_site_option('wpemfb_app_id',$_POST['wpemfb_app_id']);
27
- update_site_option('wpemfb_app_secret',$_POST['wpemfb_app_secret']);
28
- }
29
- if(isset($_POST['wpemfb_max_width'])){
30
- $prop = get_site_option('wpemfb_proportions') * $_POST['wpemfb_max_width'];
31
- update_site_option('wpemfb_max_width', $_POST['wpemfb_max_width']);
32
- update_site_option('wpemfb_height', $prop );
33
- }
34
- if(isset($_POST['wpemfb_max_photos'])){
35
- update_site_option('wpemfb_max_photos', $_POST['wpemfb_max_photos']);
36
- }
37
- if(isset($_POST['wpemfb_max_posts'])){
38
- update_site_option('wpemfb_max_posts', $_POST['wpemfb_max_posts']);
39
- }
40
- if(isset($_POST['wpemfb_theme'])){
41
- update_site_option('wpemfb_theme', $_POST['wpemfb_theme']);
42
- }
43
- if(isset($_POST['wpemfb_show_like'])){
44
- update_site_option('wpemfb_show_like', 'true');
45
- }else{
46
- update_site_option('wpemfb_show_like', 'false');
47
- }
48
- if(isset($_POST['wpemfb_enqueue_style'])){
49
- update_site_option('wpemfb_enqueue_style', 'true');
50
- }else{
51
- update_site_option('wpemfb_enqueue_style', 'false');
52
- }
53
- if(isset($_POST['wpemfb_fb_root'])){
54
- update_site_option('wpemfb_fb_root', 'true');
55
- }else{
56
- update_site_option('wpemfb_fb_root', 'false');
57
- }
58
- if(isset($_POST['wpemfb_show_follow'])){
59
- update_site_option('wpemfb_show_follow', 'true');
60
- }else{
61
- update_site_option('wpemfb_show_follow', 'false');
62
- }
63
- if(isset($_POST['wpemfb_raw_video'])){
64
- update_site_option('wpemfb_raw_video', 'true');
65
- }else{
66
- update_site_option('wpemfb_raw_video', 'false');
67
- }
68
- if(isset($_POST['wpemfb_raw_photo'])){
69
- update_site_option('wpemfb_raw_photo', 'true');
70
- }else{
71
- update_site_option('wpemfb_raw_photo', 'false');
72
- }
73
- if(isset($_POST['wpemfb_show_posts'])){
74
- update_site_option('wpemfb_show_posts', 'true');
75
- }else{
76
- update_site_option('wpemfb_show_posts', 'false');
77
- }
78
- if(isset($_POST['wpemfb_raw_post'])){
79
- update_site_option('wpemfb_raw_post', 'true');
80
- }else{
81
- update_site_option('wpemfb_raw_post', 'false');
82
- }
83
- if(isset($_POST['wpemfb_enq_lightbox'])){
84
- update_site_option('wpemfb_enq_lightbox', 'true');
85
- }else{
86
- update_site_option('wpemfb_enq_lightbox', 'false');
87
- }
88
- if(isset($_POST['wpemfb_enq_wpemfb'])){
89
- update_site_option('wpemfb_enq_wpemfb', 'true');
90
- }else{
91
- update_site_option('wpemfb_enq_wpemfb', 'false');
92
- }
93
- if(isset($_POST['wpemfb_enq_fbjs'])){
94
- update_site_option('wpemfb_enq_fbjs', 'true');
95
- }else{
96
- update_site_option('wpemfb_enq_fbjs', 'false');
97
- }
98
- if(isset($_POST['wpemfb_ev_local_tz'])){
99
- update_site_option('wpemfb_ev_local_tz', 'true');
100
- }else{
101
- update_site_option('wpemfb_ev_local_tz', 'false');
102
  }
 
 
103
 
104
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
105
  /**
106
  * Save extra options, requires coordination with 'wpemfb_options' action
107
  *
108
  * @since 1.8
109
  *
110
  */
111
- do_action('wpemfb_admin_save_data');
112
- }
113
- static function embedfb_page() {
114
- if( isset($_POST['save-data']) && wp_verify_nonce( $_POST['save-data'], 'wp-embed-facebook')){
115
- self::savedata();
116
 
117
- }
118
- $checked = (get_site_option('wpemfb_enqueue_style') === 'true') ? 'checked' : '' ;
119
- $checked2 = (get_site_option('wpemfb_show_like') === 'true') ? 'checked' : '' ;
120
- $checked3 = (get_site_option('wpemfb_fb_root') === 'true') ? 'checked' : '' ;
121
- $checked4 = (get_site_option('wpemfb_show_follow') === 'true') ? 'checked' : '' ;
122
- $checked5 = (get_site_option('wpemfb_raw_video') === 'true') ? 'checked' : '' ;
123
- $checked6 = (get_site_option('wpemfb_raw_photo') === 'true') ? 'checked' : '' ;
124
- $checked7 = (get_site_option('wpemfb_show_posts') === 'true') ? 'checked' : '' ;
125
-
126
- $checked8 = (get_site_option('wpemfb_raw_post') === 'true') ? 'checked' : '' ;
127
- $checked9 = (get_site_option('wpemfb_enq_lightbox') === 'true') ? 'checked' : '' ;
128
- $checked10 = (get_site_option('wpemfb_enq_wpemfb') === 'true') ? 'checked' : '' ;
129
- $checked11 = (get_site_option('wpemfb_enq_fbjs') === 'true') ? 'checked' : '' ;
130
- $checked12 = (get_site_option('wpemfb_ev_local_tz', 'true') === 'true') ? 'checked' : '' ;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
131
 
132
- $sel1 = (get_site_option('wpemfb_theme') === 'default') ? 'selected' : '' ;
133
- $sel2 = (get_site_option('wpemfb_theme') === 'classic') ? 'selected' : '' ;
 
134
 
135
- ?>
136
- <style>
137
- .ui-widget-content th{
138
- font-weight: normal;
139
- padding-right: 10px;
140
- }
141
- .settings-col{
142
- width: 50% !important;
143
- padding-right: 2% !important;
144
- text-align: left !important;
145
- }
146
- .welcome-panel-last{
147
- width: 47% !important;
148
- text-align: center;
149
- }
150
- @media (max-width:870px){
151
- .settings-col{
152
- width: 100% !important;
153
- }
154
- .welcome-panel-last{
155
- width: 100% !important;
156
- }
157
- }
158
- </style>
159
- <div class="wrap">
160
- <h2>WP Embed Facebook</h2>
161
- <div class="welcome-panel">
162
- <div class="welcome-panel-content">
163
- <div class="welcome-panel-column-container">
164
- <div class="welcome-panel-column settings-col" >
165
- <form id="config-form" action="#" method="post">
166
- <?php wp_nonce_field( 'wp-embed-facebook','save-data' ); ?>
167
- <div id="accordion">
168
- <h5><?php _e('Facebook application data', 'wp-embed-facebook') ?></h5>
169
- <div>
170
- <table>
171
- <tbody>
172
- <tr valign="middle">
173
- <th>App ID</th>
174
- <td>
175
- <input type="text" name="wpemfb_app_id" required value="<?php echo get_site_option('wpemfb_app_id') ?>" size="38" />
176
- </td>
177
- </tr>
178
- <tr valign="middle">
179
- <th>App Secret</th>
180
- <td>
181
- <input type="text" name="wpemfb_app_secret" required value="<?php echo get_site_option('wpemfb_app_secret') ?>" size="38" />
182
- </td>
183
- </tr>
184
- </table>
185
- </div>
186
- <h5><?php _e('General Options','wp-embed-facebook') ?></h5>
187
- <div>
188
- <table>
189
- <tbody>
190
- <tr>
191
- <th><?php _e("Template to use", 'wp-embed-facebook') ?></th>
192
- <td>
193
- <select name="wpemfb_theme">
194
- <option value="default" <?php echo $sel1 ?> >Default</option>
195
- <option value="classic" <?php echo $sel2 ?> >Classic</option>
196
- <?php
197
- /**
198
- * Add a new theme option
199
- *
200
- * @since 1.8
201
- *
202
- */
203
- do_action('wpemfb_admin_theme');
204
- ?>
205
- </select>
206
- </td>
207
- </tr>
208
- <tr valign="middle">
209
- <th><?php _e('Embed Max-Width','wp-embed-facebook') ?></th>
210
- <td>
211
- <input type="number" name="wpemfb_max_width" value="<?php echo get_site_option('wpemfb_max_width') ?>" />
212
- </td>
213
- </tr>
214
- <tr valign="middle">
215
- <th><?php _e('Number of Photos <br>on Embedded Albums','wp-embed-facebook') ?></th>
216
- <td>
217
- <input type="number" name="wpemfb_max_photos" value="<?php echo get_site_option('wpemfb_max_photos') ?>" />
218
- </td>
219
- </tr>
220
- <tr valign="middle">
221
- <th><?php _e('Show follow button <br>on Embedded Profiles','wp-embed-facebook') ?></th>
222
- <td>
223
- <input type="checkbox" name="wpemfb_show_follow" <?php echo $checked4 ?> />
224
- </td>
225
- </tr>
226
- </tbody>
227
- </table>
228
- </div>
229
- <h5><?php _e('Embedded Fan Pages', 'wp-embed-facebook') ?></h5>
230
- <div>
231
- <table>
232
- <tbody>
233
- <tr valign="middle">
234
- <th><?php _e('Show like button','wp-embed-facebook') ?></th>
235
- <td>
236
- <input type="checkbox" name="wpemfb_show_like" <?php echo $checked2 ?> />
237
- </td>
238
- </tr>
239
- <tr valign="middle">
240
- <th><?php _e('Show latest posts','wp-embed-facebook') ?></th>
241
- <td>
242
- <input type="checkbox" name="wpemfb_show_posts" <?php echo $checked7 ?> />
243
- </td>
244
- </tr>
245
- <tr valign="middle">
246
- <th><?php _e('Number of posts','wp-embed-facebook') ?></th>
247
- <td>
248
- <input type="number" name="wpemfb_max_posts" value="<?php echo get_site_option('wpemfb_max_posts') ?>" style="width: 60px;"/>
249
- </td>
250
- </tr>
251
- <tr valign="middle">
252
- <th><?php _e('Show events on local time','wp-embed-facebook') ?></th>
253
- <td>
254
- <input type="checkbox" name="wpemfb_ev_local_tz" <?php echo $checked12 ?> />
255
- </td>
256
- </tr>
257
- </tbody>
258
- </table>
259
- </div>
260
- <h5><?php _e('Raw Embedded Options', 'wp-embed-facebook') ?></h5>
261
- <div>
262
- <table>
263
- <tbody>
264
- <tr valign="middle">
265
- <th><?php _e('Embed Videos Raw','wp-embed-facebook') ?>
266
- </th>
267
-
268
- <td>
269
- <input type="checkbox" name="wpemfb_raw_video" <?php echo $checked5 ?> />
270
- </td>
271
- </tr>
272
- <tr valign="middle">
273
- <th><?php _e('Embed Photos Raw','wp-embed-facebook') ?></th>
274
- <td>
275
- <input type="checkbox" name="wpemfb_raw_photo" <?php echo $checked6 ?> />
276
- </td>
277
- </tr>
278
- <?php
279
- /*
280
- <tr valign="middle">
281
- <th><?php _e('Embed Posts Raw','wp-embed-facebook') ?></th>
282
- <td>
283
- <input type="checkbox" name="wpemfb_raw_post" <?php echo $checked8 ?> />
284
- </td>
285
- </tr>
286
- */
287
- ?>
288
 
289
- </tbody>
290
- </table>
291
- </div>
292
- <?php
293
- /**
294
- * Add more options to the plugin page save them with 'wpemfb_admin_save_data' action
295
- *
296
- * @since 1.8
297
- *
298
- */
299
- do_action('wpemfb_options');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
300
  ?>
301
- <h5><?php _e('Advanced Options', 'wp-embed-facebook') ?></h5>
302
- <div>
303
- <table>
304
- <tbody>
305
- <tr valign="middle">
306
- <th><?php _e('Enqueue Styles','wp-embed-facebook') ?></th>
307
- <td>
308
- <input type="checkbox" name="wpemfb_enqueue_style" <?php echo $checked ?> />
309
- </td>
310
- </tr>
311
- <tr valign="middle">
312
- <th><?php _e('Add fb-root on top of content','wp-embed-facebook') ?><br><small><?php _e('Some themes may not need this','wp-embed-facebook') ?></small></th>
313
- <td>
314
- <input type="checkbox" name="wpemfb_fb_root" <?php echo $checked3 ?> />
315
- </td>
316
- </tr>
317
- <tr valign="middle">
318
- <th><?php _e('Enqueue Lightbox script','wp-embed-facebook') ?></th>
319
- <td>
320
- <input type="checkbox" name="wpemfb_enq_lightbox" <?php echo $checked9 ?> />
321
- </td>
322
- </tr>
323
- <tr valign="middle">
324
- <th><?php _e('Enqueue WPEmbedFB script','wp-embed-facebook') ?><br></th>
325
- <td>
326
- <input type="checkbox" name="wpemfb_enq_wpemfb" <?php echo $checked10 ?> />
327
- </td>
328
- </tr>
329
- <tr valign="middle">
330
- <th><?php _e('Enqueue Facebook SDK','wp-embed-facebook') ?><br></th>
331
- <td>
332
- <input type="checkbox" name="wpemfb_enq_fbjs" <?php echo $checked11 ?> />
333
- </td>
334
- </tr>
335
- </tbody>
336
- </table>
337
- </div>
338
- </div>
339
- <input type="submit" name="submit" class="button button-primary button-hero" value="<?php _e('Save','wp-embed-facebook') ?>" />
340
- </form>
341
- </div>
342
- <div class="welcome-panel-column welcome-panel-last" >
343
- <?php ob_start(); ?>
344
- <h3><?php _e( 'Premium Version Available', 'wp-embed-facebook') ?></h3>
345
- <h2><?php _e( 'Only $6.99 USD', 'wp-embed-facebook') ?></h2>
346
- <br>
347
- <a class="button button-primary" href="http://www.wpembedfb.com/premium"><?php _e('Check it out', 'wp-embed-facebook') ?></a>
348
- <br>
349
- <ul>
350
- <li>
351
- <?php _e('Events with cover', 'wp-embed-facebook') ?>
352
- </li>
353
- <li>
354
- <?php _e('Fan Page Full Embed', 'wp-embed-facebook') ?>
355
- </li>
356
- <!--
357
- <li>
358
- <?php _e('More Responsive Templates', 'wp-embed-facebook') ?>
359
- </li>
360
- -->
361
- <li>
362
- <?php _e('One Year Premium Support', 'wp-embed-facebook') ?>
363
- </li>
364
- </ul>
365
- <hr>
366
- <p>
367
- <small><?php _e( 'More information', 'wp-embed-facebook') ?></small><br>
368
- <a href="http://www.wpembedfb.com" style="color:#23487F;"><?php _e('Plugin Web Site','wp-embed-facebook') ?></a>
369
- </p>
370
- <hr>
371
- <p>
372
- <img src="<?php echo plugins_url('/img/hechoenmexico.png', __FILE__) ?>" width="60px" />
373
- </p>
374
- <?php echo apply_filters('wpemfb_admin',ob_get_clean()); ?>
375
- </div>
376
- </div>
377
- </div>
378
- </div>
379
- </div>
380
- <?php
381
- }
 
 
 
 
 
 
 
 
 
 
382
  }
1
  <?php
2
+
3
+ //TODO add option
4
+ class EmbFbAdmin
5
+ {
6
+ static function admin_enqueue_scripts($hook_suffix)
7
+ {
8
+ if ($hook_suffix == 'settings_page_embedfacebook') {
9
+ global $wp_scripts;
10
+ wp_enqueue_script('wpemfb-admin', WPEMFBURL . 'lib/js/admin.js', array('jquery-ui-accordion'));
11
+ $queryui = $wp_scripts->query('jquery-ui-core');
12
+ $url = "http://ajax.googleapis.com/ajax/libs/jqueryui/" . $queryui->ver . "/themes/smoothness/jquery-ui.css";
13
+ wp_enqueue_style('jquery-ui-start', $url, false, null);
14
+ }
15
+ $translation_array = array('local' => get_locale(), 'fb_id' => get_site_option('wpemfb_app_id'), 'fb_root' => get_site_option('wpemfb_fb_root'));
16
+ wp_localize_script('wpemfb', 'WEF', $translation_array);
17
  wp_enqueue_script('wpemfb');
18
+ }
19
+
20
+ static function admin_init()
21
+ {
22
+ $theme = get_site_option('wpemfb_theme');
23
+ add_editor_style(WPEMFBURL . 'templates/' . $theme . '/wpemfb.css');
24
+ }
25
+
26
+ static function add_page()
27
+ {
28
+ add_options_page('EmbedFacebook', 'Embed Facebook', 'manage_options', 'embedfacebook', array('EmbFbAdmin', 'embedfb_page'));
29
+ }
30
+
31
+ /**
32
+ * @param $option string option name
33
+ * @param $type string direct or true/false
34
+ */
35
+ static function save_option($option, $type)
36
+ {
37
+ if ($type == 'direct') {
38
+ if (isset($_POST[$option])) {
39
+ update_site_option($option, $_POST[$option]);
40
+ }
41
+ } else {
42
+ if (isset($_POST[$option])) {
43
+ update_site_option($option, 'true');
44
+ } else {
45
+ update_site_option($option, 'false');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
46
  }
47
+ }
48
+ }
49
 
50
+ static function savedata()
51
+ {
52
+ if (isset($_POST['wpemfb_app_secret'], $_POST['wpemfb_app_id'])) {
53
+
54
+ $options = array(
55
+ 'wpemfb_app_id' => 'direct',
56
+ 'wpemfb_app_secret' => 'direct',
57
+ 'wpemfb_max_width' => 'direct',
58
+ 'wpemfb_max_photos' => 'direct',
59
+ 'wpemfb_max_posts' => 'direct',
60
+ 'wpemfb_theme' => 'direct',
61
+ 'wpemfb_show_like' => 'true/false',
62
+ 'wpemfb_enqueue_style' => 'true/false',
63
+ 'wpemfb_fb_root' => 'true/false',
64
+ 'wpemfb_show_follow' => 'true/false',
65
+ 'wpemfb_raw_video' => 'true/false',
66
+ 'wpemfb_raw_photo' => 'true/false',
67
+ 'wpemfb_show_posts' => 'true/false',
68
+ 'wpemfb_raw_post' => 'true/false',
69
+ 'wpemfb_enq_lightbox' => 'true/false',
70
+ 'wpemfb_enq_wpemfb' => 'true/false',
71
+ 'wpemfb_enq_fbjs' => 'true/false',
72
+ 'wpemfb_ev_local_tz' => 'true/false',
73
+ 'wpemfb_raw_video_fb' => 'true/false',
74
+ 'wpemfb_raw_video_fb_sc'=> 'true/false',
75
+ );
76
+ foreach ($options as $option => $type) {
77
+ self::save_option($option, $type);
78
+ }
79
+ if (isset($_POST['wpemfb_max_width']) && is_int($_POST['wpemfb_max_width'])) {
80
+ $prop = get_site_option('wpemfb_proportions') * $_POST['wpemfb_max_width'];
81
+ update_site_option('wpemfb_height', $prop);
82
+ }
83
+ }
84
  /**
85
  * Save extra options, requires coordination with 'wpemfb_options' action
86
  *
87
  * @since 1.8
88
  *
89
  */
90
+ do_action('wpemfb_admin_save_data');
91
+ }
 
 
 
92
 
93
+ static function field($type, $name, $label, $args = array())
94
+ {
95
+ switch ($type) {
96
+ case 'checkbox':
97
+ ob_start();
98
+ ?>
99
+ <tr valign="middle">
100
+ <th><?php echo $label ?></th>
101
+ <td>
102
+ <input type="checkbox"
103
+ name="<?php echo $name ?>" <?php echo (get_site_option($name) === 'true') ? 'checked' : '' ?> />
104
+ </td>
105
+ </tr>
106
+ <?php
107
+ ob_end_flush();
108
+ break;
109
+ default:
110
+ ob_start();
111
+ ?>
112
+ <tr valign="middle">
113
+ <th><?php echo $label ?></th>
114
+ <td>
115
+ <input type="<?php echo $type ?>"
116
+ name="<?php echo $name ?>" <?php echo isset($args['required']) ? 'required' : '' ?>
117
+ value="<?php echo get_site_option($name) ?>" size="38"/>
118
+ </td>
119
+ </tr>
120
+ <?php
121
+ ob_end_flush();
122
+ }
123
+ }
124
+ static function section($start=false, $title=''){
125
+ if($start) :
126
+ ?>
127
+ <h5><?php echo $title ?></h5>
128
+ <div>
129
+ <table>
130
+ <tbody>
131
+ <?php
132
+ else :
133
+ ?>
134
+ </tbody>
135
+ </table>
136
+ </div>
137
+ <?php
138
+ endif;
139
+ }
140
+ static function embedfb_page()
141
+ {
142
+ if (isset($_POST['save-data']) && wp_verify_nonce($_POST['save-data'], 'wp-embed-facebook')) {
143
+ self::savedata();
144
 
145
+ }
146
+ $sel1 = (get_site_option('wpemfb_theme') === 'default') ? 'selected' : '';
147
+ $sel2 = (get_site_option('wpemfb_theme') === 'classic') ? 'selected' : '';
148
 
149
+ ?>
150
+ <style>
151
+ .ui-widget-content th {
152
+ font-weight: normal;
153
+ padding-right: 10px;
154
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
155
 
156
+ .settings-col {
157
+ width: 50% !important;
158
+ padding-right: 2% !important;
159
+ text-align: left !important;
160
+ }
161
+
162
+ .welcome-panel-last {
163
+ width: 47% !important;
164
+ text-align: center;
165
+ }
166
+
167
+ @media (max-width: 870px) {
168
+ .settings-col {
169
+ width: 100% !important;
170
+ }
171
+
172
+ .welcome-panel-last {
173
+ width: 100% !important;
174
+ }
175
+ }
176
+ </style>
177
+ <div class="wrap">
178
+ <h2>WP Embed Facebook</h2>
179
+ <div class="welcome-panel">
180
+ <div class="welcome-panel-content">
181
+ <div class="welcome-panel-column-container">
182
+ <div class="welcome-panel-column settings-col">
183
+ <form id="config-form" action="#" method="post">
184
+ <?php wp_nonce_field('wp-embed-facebook', 'save-data'); ?>
185
+ <div id="accordion">
186
+ <?php
187
+ self::section(true, __('Facebook application data', 'wp-embed-facebook'));
188
+ self::field('text', 'wpemfb_app_id', __('App ID', 'wp-embed-facebook'), array('required' => 'true'));
189
+ self::field('text', 'wpemfb_app_secret', __('App Secret', 'wp-embed-facebook'), array('required' => 'true'));
190
+ self::section();
191
  ?>
192
+ <?php self::section(true, __("General Options", 'wp-embed-facebook')); ?>
193
+ <tr valign="middle">
194
+ <th><?php _e("Template to use", 'wp-embed-facebook') ?></th>
195
+ <td>
196
+ <select name="wpemfb_theme">
197
+ <option value="default" <?php echo $sel1 ?> >Default</option>
198
+ <option value="classic" <?php echo $sel2 ?> >Classic</option>
199
+ <?php
200
+ /**
201
+ * Add a new theme option
202
+ * @since 1.8
203
+ */
204
+ do_action('wpemfb_admin_theme');
205
+ ?>
206
+ </select>
207
+ </td>
208
+ </tr>
209
+ <?php
210
+ self::field('number', 'wpemfb_max_width', __('Embed Max-Width', 'wp-embed-facebook'));
211
+ self::field('number', 'wpemfb_max_photos', __('Number of Photos <br>on Embedded Albums', 'wp-embed-facebook'));
212
+ self::field('checkbox', 'wpemfb_show_follow', __('Show follow button <br>on Embedded Profiles', 'wp-embed-facebook'));
213
+ self::section();
214
+ self::section(true, __('Embedded Fan Pages', 'wp-embed-facebook'));
215
+ self::field('checkbox', 'wpemfb_show_like', __('Show like button', 'wp-embed-facebook'));
216
+ self::field('checkbox', 'wpemfb_show_posts', __('Show latest posts', 'wp-embed-facebook'));
217
+ self::field('number', 'wpemfb_max_posts', __('Number of posts', 'wp-embed-facebook'));
218
+ self::field('checkbox', 'wpemfb_ev_local_tz', __('Show events on local time', 'wp-embed-facebook'));
219
+ self::section();
220
+ self::section(true, __('Raw Embedded Options', 'wp-embed-facebook'));
221
+ self::field('checkbox', 'wpemfb_raw_video', __('Embed Videos Raw', 'wp-embed-facebook'));
222
+ self::field('checkbox', 'wpemfb_raw_photo', __('Embed Photos Raw', 'wp-embed-facebook'));
223
+ self::field('checkbox', 'wpemfb_raw_video_fb', __('Use Facebook embed code on raw videos', 'wp-embed-facebook'));
224
+ self::field('checkbox', 'wpemfb_raw_video_fb_sc', __('Use Facebook embed code on raw video shortcode', 'wp-embed-facebook'));
225
+ self::section();
226
+ /**
227
+ * Add more options to the plugin page save them with 'wpemfb_admin_save_data' action
228
+ * @since 1.8
229
+ */
230
+ do_action('wpemfb_options');
231
+ self::section(true, __('Advanced Options', 'wp-embed-facebook'));
232
+ self::field('checkbox', 'wpemfb_enqueue_style', __('Enqueue Styles', 'wp-embed-facebook'));
233
+ self::field('checkbox', 'wpemfb_fb_root', __('Add fb-root on top of content', 'wp-embed-facebook'));
234
+ self::field('checkbox', 'wpemfb_enq_lightbox', __('Enqueue Lightbox script', 'wp-embed-facebook'));
235
+ self::field('checkbox', 'wpemfb_enq_wpemfb', __('Enqueue WPEmbedFB script', 'wp-embed-facebook'));
236
+ self::field('checkbox', 'wpemfb_enq_fbjs', __('Enqueue Facebook SDK', 'wp-embed-facebook'));
237
+ self::section();
238
+ ?>
239
+ </div>
240
+ <input type="submit" name="submit" class="button button-primary button-hero"
241
+ value="<?php _e('Save', 'wp-embed-facebook') ?>"/>
242
+ </form>
243
+ </div>
244
+ <div class="welcome-panel-column welcome-panel-last">
245
+ <?php ob_start(); ?>
246
+ <h3><?php _e('Premium Version Available', 'wp-embed-facebook') ?></h3>
247
+
248
+ <h2><?php _e('Only $6.99 USD', 'wp-embed-facebook') ?></h2>
249
+ <br>
250
+ <a class="button button-primary"
251
+ href="http://www.wpembedfb.com/premium"><?php _e('Check it out', 'wp-embed-facebook') ?></a>
252
+ <br>
253
+ <ul>
254
+ <li>
255
+ <?php _e('Events with cover', 'wp-embed-facebook') ?>
256
+ </li>
257
+ <li>
258
+ <?php _e('Fan Page Full Embed', 'wp-embed-facebook') ?>
259
+ </li>
260
+ <li>
261
+ <?php _e('One Year Premium Support', 'wp-embed-facebook') ?>
262
+ </li>
263
+ </ul>
264
+ <hr>
265
+ <p>
266
+ <small><?php _e('More information', 'wp-embed-facebook') ?></small>
267
+ <br>
268
+ <a href="http://www.wpembedfb.com"
269
+ style="color:#23487F;"><?php _e('Plugin Web Site', 'wp-embed-facebook') ?></a>
270
+ </p>
271
+ <hr>
272
+ <p>
273
+ <img src="<?php echo plugins_url('/img/hechoenmexico.png', __FILE__) ?>" width="60px"/>
274
+ </p>
275
+ <?php echo apply_filters('wpemfb_admin', ob_get_clean()); ?>
276
+ </div>
277
+ </div>
278
+ </div>
279
+ </div>
280
+ </div>
281
+ <?php
282
+ }
283
  }
lib/core.php CHANGED
@@ -11,6 +11,7 @@ class WP_Embed_FB {
11
  static $raw = '';
12
  static $premium = '';
13
  static $num_posts = '';
 
14
  /**
15
  * Save default values to data base
16
  */
@@ -65,7 +66,8 @@ class WP_Embed_FB {
65
  'wpemfb_enq_lightbox' => 'true',
66
  'wpemfb_enq_wpemfb' => 'true',
67
  'wpemfb_enq_fbjs' => 'true',
68
- 'wpemfb_ev_local_tz' => 'true'
 
69
  );
70
  }
71
  //("uninstalled","deactivated","activated","reactivated")
@@ -236,7 +238,7 @@ class WP_Embed_FB {
236
  * @param string $type The detected type of embed
237
  *
238
  */
239
- $fb_data = $wp_emb_fbsdk->api('/v2.0/'.apply_filters('wpemfb_api_string',$api_string,$fb_id,$type));
240
  $num_posts = self::$num_posts !== '' && is_numeric(self::$num_posts) ? self::$num_posts : get_option("wpemfb_max_posts");
241
  $api_string2 = '';
242
  if(isset($fb_data['embed_html']))
@@ -257,7 +259,7 @@ class WP_Embed_FB {
257
  $api_string2 = apply_filters('wpemfb_2nd_api_string',$api_string2,$fb_data,$type);
258
 
259
  if(!empty($api_string2)){
260
- $extra_data = $wp_emb_fbsdk->api('/v2.0/'.$api_string2);
261
  $fb_data = array_merge($fb_data,$extra_data);
262
  }
263
  /**
@@ -338,6 +340,7 @@ class WP_Embed_FB {
338
  $width = self::$width;
339
  $height = self::$height;
340
  }
 
341
  $prop = get_option('wpemfb_proportions');
342
  ob_start();
343
  //show embed post on admin
11
  static $raw = '';
12
  static $premium = '';
13
  static $num_posts = '';
14
+ static $poster = '';
15
  /**
16
  * Save default values to data base
17
  */
66
  'wpemfb_enq_lightbox' => 'true',
67
  'wpemfb_enq_wpemfb' => 'true',
68
  'wpemfb_enq_fbjs' => 'true',
69
+ 'wpemfb_ev_local_tz' => 'true',
70
+ 'wpemfb_raw_video_fb' => 'false',
71
  );
72
  }
73
  //("uninstalled","deactivated","activated","reactivated")
238
  * @param string $type The detected type of embed
239
  *
240
  */
241
+ $fb_data = $wp_emb_fbsdk->api('/v2.3/'.apply_filters('wpemfb_api_string',$api_string,$fb_id,$type));
242
  $num_posts = self::$num_posts !== '' && is_numeric(self::$num_posts) ? self::$num_posts : get_option("wpemfb_max_posts");
243
  $api_string2 = '';
244
  if(isset($fb_data['embed_html']))
259
  $api_string2 = apply_filters('wpemfb_2nd_api_string',$api_string2,$fb_data,$type);
260
 
261
  if(!empty($api_string2)){
262
+ $extra_data = $wp_emb_fbsdk->api('/v2.3/'.$api_string2);
263
  $fb_data = array_merge($fb_data,$extra_data);
264
  }
265
  /**
340
  $width = self::$width;
341
  $height = self::$height;
342
  }
343
+ $poster = self::$poster;
344
  $prop = get_option('wpemfb_proportions');
345
  ob_start();
346
  //show embed post on admin
readme.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: poxtron
3
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=R8Q85GT3Q8Q26
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.1
7
- Stable tag: 1.9.3
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -12,6 +12,8 @@ Embed a Facebook video, page, event, album, photo, profile or post to any Wordpr
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, will return a link.
16
 
17
  = Supported Embeds =
@@ -80,6 +82,12 @@ The embedded post code comes directly from facebook so there is no easy way to c
80
 
81
  == Changelog ==
82
 
 
 
 
 
 
 
83
  = 1.9.3 =
84
  * Fixed error on older versions of PHP
85
 
@@ -182,5 +190,5 @@ The embedded post code comes directly from facebook so there is no easy way to c
182
 
183
  == Upgrade Notice ==
184
 
185
- = 1.9.3 =
186
- * Fixed error on older versions of PHP
3
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=R8Q85GT3Q8Q26
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.2
7
+ Stable tag: 1.9.4
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
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 =
82
 
83
  == Changelog ==
84
 
85
+ = 1.9.4 =
86
+ * Added option to embed raw videos with facebook code
87
+ * Added poster on raw embed videos
88
+ * Update to FB API v2.3
89
+ * Update raw photo template
90
+
91
  = 1.9.3 =
92
  * Fixed error on older versions of PHP
93
 
190
 
191
  == Upgrade Notice ==
192
 
193
+ = 1.9.4 =
194
+ * Updated to FB API v2.3, display raw video posters & new option to use FB embed code for raw videos.
templates/classic/photo.php CHANGED
@@ -6,8 +6,6 @@
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
+ <a href="<?php echo $fb_data['link'] ?>" target="_blank" rel="nofollow">
10
+ <img src="<?php echo $fb_data['source'] ?>" width="<?php echo $width ?>px" height="auto" style="max-width: <?php echo $width ?>px" />
11
+ </a>
 
 
templates/classic/video.php CHANGED
@@ -13,7 +13,7 @@
13
  $type_array = explode('.',$file);
14
  $type = end($type_array);
15
  $clean_type = strtolower($type);
16
- if( $clean_type == 'mp4' ) :?>
17
 
18
  <video controls>
19
  <source src="<?php echo $fb_data['source'] ?>" type="video/<?php echo $clean_type ?>">
13
  $type_array = explode('.',$file);
14
  $type = end($type_array);
15
  $clean_type = strtolower($type);
16
+ if( get_site_option('wpemfb_raw_video_fb') == 'false' && $clean_type == 'mp4' ) :?>
17
 
18
  <video controls>
19
  <source src="<?php echo $fb_data['source'] ?>" type="video/<?php echo $clean_type ?>">
templates/default/photo.php CHANGED
@@ -6,12 +6,6 @@
6
  $width = $width;
7
  $height = $width * $prop;
8
  ?>
9
- <div class="wpemfb-container" style="max-width: <?php echo $width ?>px">
10
- <div class="wpemfb-row">
11
- <div class="wpemfb-col-12">
12
- <a href="<?php echo $fb_data['link'] ?>" target="_blank" rel="nofollow">
13
- <img src="<?php echo $fb_data['source'] ?>" width="100%" height="auto" style="max-width: <?php echo $width ?>px" />
14
- </a>
15
- </div>
16
- </div>
17
- </div>
6
  $width = $width;
7
  $height = $width * $prop;
8
  ?>
9
+ <a href="<?php echo $fb_data['link'] ?>" target="_blank" rel="nofollow">
10
+ <img src="<?php echo $fb_data['source'] ?>" width="<?php echo $width ?>px" height="auto" style="max-width: <?php echo $width ?>px" />
11
+ </a>
 
 
 
 
 
 
templates/default/video.php CHANGED
@@ -2,6 +2,7 @@
2
  /*
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 style="width: <?php echo $width ?>px">
@@ -13,16 +14,18 @@
13
  $type_array = explode('.',$file);
14
  $type = end($type_array);
15
  $clean_type = strtolower($type);
16
- if( $clean_type == 'mp4' ) :?>
17
 
18
- <video controls>
 
 
 
19
  <source src="<?php echo $fb_data['source'] ?>" type="video/<?php echo $clean_type ?>">
20
  </video>
21
 
22
  <?php else : ?>
23
 
24
  <div class="fb-video" data-allowfullscreen="true"
25
- data-href="https://www.facebook.com/video/embed?video_id=<?php echo $fb_data['id'] ?>">
26
  </div>
27
 
28
  <?php endif; ?>
2
  /*
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
  ?>
8
  <div style="width: <?php echo $width ?>px">
14
  $type_array = explode('.',$file);
15
  $type = end($type_array);
16
  $clean_type = strtolower($type);
 
17
 
18
+ if( get_site_option('wpemfb_raw_video_fb') == 'false' && $clean_type == 'mp4' ) :?>
19
+ <?php $end = isset($fb_data['format']) ? end($fb_data['format']) : $fb_data; ?>
20
+
21
+ <video controls poster="<?php echo $end['picture'] ?>" >
22
  <source src="<?php echo $fb_data['source'] ?>" type="video/<?php echo $clean_type ?>">
23
  </video>
24
 
25
  <?php else : ?>
26
 
27
  <div class="fb-video" data-allowfullscreen="true"
28
+ data-href="/<?php echo $fb_data['from']['id'] ?>/videos/<?php echo $fb_data['id'] ?>">
29
  </div>
30
 
31
  <?php endif; ?>
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.3
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.4
8
  Author URI: http://profiles.wordpress.org/poxtron/
9
  */
10