WP Embed Facebook - Version 2.1

Version Description

  • Removed all options and moved them to a single one 'wpemfb_options'
  • Removed resize cover javascript it is now done with css
  • Fixed timezone bug custom post and events
  • Added option to only load scripts when an embed is present
  • Added option to reset all options
  • Added Jetpack Photon compatibility
  • Added X Theme compatibility
  • Added lightbox.sass for theme developers
  • Updated Lightbox script and style
  • Added Lightbox Option Album Label
  • Added Lightbox Option Always Show Nav On Touch Devices
  • Added Lightbox Option Show Image Number Label
  • Added Lightbox Option Wrap Around
  • Added Lightbox Option Disable Scrolling
  • Added Lightbox Option Fit Images In Viewport
  • Added Lightbox Option Max Width
  • Added Lightbox Option Max Height
  • Added Lightbox Option Position From Top
  • Added Lightbox Option Resize Duration
  • Added Lightbox Option Fade Duration
  • Changed css on classic theme
Download this release

Release Info

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

Code changes from version 2.0.9.1 to 2.1

Files changed (43) hide show
  1. lib/class-wef-social-plugins.php +10 -9
  2. lib/class-wp-embed-fb-admin.php +171 -132
  3. lib/class-wp-embed-fb-plugin.php +465 -265
  4. lib/class-wp-embed-fb.php +260 -171
  5. lib/js/fb.js +6 -6
  6. lib/js/fb.min.js +1 -0
  7. lib/js/wpembedfb.js +1 -10
  8. lib/js/wpembedfb.min.js +1 -0
  9. lib/lightbox2/css/lightbox.css +1 -0
  10. lib/lightbox2/css/lightbox.min.css +0 -1
  11. lib/lightbox2/css/lightbox.sass +168 -0
  12. lib/lightbox2/images/close.png +0 -0
  13. lib/lightbox2/images/loading.gif +0 -0
  14. lib/lightbox2/images/next.png +0 -0
  15. lib/lightbox2/images/prev.png +0 -0
  16. lib/lightbox2/js/lightbox.js +453 -0
  17. lib/lightbox2/js/lightbox.min.js +1 -129
  18. lib/lightbox2/js/lightbox.min.map +0 -1
  19. readme.txt +44 -9
  20. templates/classic/album.php +10 -9
  21. templates/classic/classic.css +1 -189
  22. templates/classic/classic.sass +35 -17
  23. templates/classic/com-page.php +2 -2
  24. templates/classic/event.php +6 -8
  25. templates/classic/page.php +6 -10
  26. templates/classic/photo.php +1 -1
  27. templates/classic/post.php +2 -2
  28. templates/classic/profile.php +2 -2
  29. templates/classic/single-post.php +10 -8
  30. templates/classic/social-plugin.php +1 -1
  31. templates/classic/video.php +3 -3
  32. templates/default/album.php +10 -9
  33. templates/default/com-page.php +1 -1
  34. templates/default/default.css +1 -192
  35. templates/default/default.sass +33 -18
  36. templates/default/event.php +5 -7
  37. templates/default/page.php +4 -9
  38. templates/default/post.php +1 -1
  39. templates/default/profile.php +1 -1
  40. templates/default/single-post.php +10 -8
  41. templates/default/social-plugin.php +9 -10
  42. templates/default/video.php +2 -2
  43. wp-embed-facebook.php +4 -4
lib/class-wef-social-plugins.php CHANGED
@@ -29,11 +29,12 @@ class WEF_Social_Plugins {
29
  'show_faces' => 'false',
30
  );
31
  $options = wp_parse_args( $options, $defaults );
32
- $string = '';
33
- foreach($options as $data => $value){
34
- $string .= " data-".str_replace('_','-',$data)."=$value";
35
  }
36
- return '<div class="fb-like" data-href="' . $href . '"'.$string.' data-action="like"></div>';
 
37
  }
38
 
39
  /**
@@ -72,11 +73,11 @@ class WEF_Social_Plugins {
72
  */
73
  static function page_plugin( $href, $width, $options = array() ) {
74
  $defaults = array(
75
- 'hide_cover' => get_option('wpemfb_page_hide_cover'),
76
- 'show_facepile' => get_option('wpemfb_page_show_faces'),
77
- 'show_posts' => get_option('wpemfb_page_show_posts'),
78
- 'small_header' => get_option('wpemfb_page_small_header'),
79
- 'height' => get_option('wpemfb_page_height'),
80
  );
81
  $options = wp_parse_args( $options, $defaults );
82
 
29
  'show_faces' => 'false',
30
  );
31
  $options = wp_parse_args( $options, $defaults );
32
+ $string = '';
33
+ foreach ( $options as $data => $value ) {
34
+ $string .= " data-" . str_replace( '_', '-', $data ) . "=$value";
35
  }
36
+
37
+ return '<div class="fb-like" data-href="' . $href . '"' . $string . ' data-action="like"></div>';
38
  }
39
 
40
  /**
73
  */
74
  static function page_plugin( $href, $width, $options = array() ) {
75
  $defaults = array(
76
+ 'hide_cover' => WP_Embed_FB_Plugin::get_option( 'page_hide_cover' ),
77
+ 'show_facepile' => WP_Embed_FB_Plugin::get_option( 'page_show_faces' ),
78
+ 'show_posts' => WP_Embed_FB_Plugin::get_option( 'page_show_posts' ),
79
+ 'small_header' => WP_Embed_FB_Plugin::get_option( 'page_small_header' ),
80
+ 'height' => WP_Embed_FB_Plugin::get_option( 'page_height' ),
81
  );
82
  $options = wp_parse_args( $options, $defaults );
83
 
lib/class-wp-embed-fb-admin.php CHANGED
@@ -1,4 +1,5 @@
1
  <?php
 
2
  class WP_Embed_FB_Admin {
3
  /**
4
  * Add WP Embed Facebook page to Settings
@@ -19,17 +20,18 @@ class WP_Embed_FB_Admin {
19
  if ( $hook_suffix == 'settings_page_embedfacebook' ) {
20
  wp_enqueue_style( 'wpemfb-admin-css', WP_Embed_FB_Plugin::get_url() . 'lib/admin/admin.css' );
21
  }
22
- wp_enqueue_style('wpemfb-default', WP_Embed_FB_Plugin::get_url().'templates/default/default.css',array(),false);
23
- wp_enqueue_style('wpemfb-classic', WP_Embed_FB_Plugin::get_url().'templates/classic/classic.css',array(),false);
24
- wp_enqueue_style('wpemfb-lightbox', WP_Embed_FB_Plugin::get_url().'lib/lightbox2/css/lightbox.css',array(),false);
25
  }
26
- static function in_admin_footer(){
 
27
  global $hook_suffix;
28
  ob_start();
29
- if($hook_suffix == 'settings_page_embedfacebook') :
30
  ?>
31
  <script type="text/javascript">
32
- jQuery(document).ready(function() {
33
  var sections = jQuery('section');
34
  sections.first().show();
35
  jQuery(".nav-tab-wrapper a").on('click', function (event) {
@@ -45,15 +47,15 @@ class WP_Embed_FB_Admin {
45
  </script>
46
  <?php
47
  endif;
48
- if(get_option('wpemfb_close_warning2','false') == 'false') :
49
  ?>
50
  <script type="text/javascript">
51
- jQuery(document).on( 'click', '.wpemfb_warning .notice-dismiss', function() {
52
- jQuery.post(ajaxurl, { action: 'wpemfb_close_warning' });
53
  });
54
- jQuery(document).on( 'click', '#wef-video-down', function(e) {
55
  e.preventDefault();
56
- jQuery.post(ajaxurl, { action: 'wpemfb_video_down' },function(){
57
  window.location = "<?php echo admin_url("options-general.php?page=embedfacebook"); ?>"
58
  });
59
 
@@ -64,8 +66,9 @@ class WP_Embed_FB_Admin {
64
  echo ob_get_clean();
65
  }
66
 
67
- static function add_action_link($links){
68
- array_unshift( $links, '<a href="'.admin_url("options-general.php?page=embedfacebook").'">'.__("Settings").'</a>' );
 
69
  return $links;
70
  }
71
 
@@ -73,7 +76,7 @@ class WP_Embed_FB_Admin {
73
  * Add template editor style to the embeds.
74
  */
75
  static function admin_init() {
76
- $theme = get_option( 'wpemfb_theme' );
77
  add_editor_style( WP_Embed_FB_Plugin::get_url() . '/templates/' . $theme . '/' . $theme . '.css' );
78
  }
79
 
@@ -104,36 +107,42 @@ class WP_Embed_FB_Admin {
104
  * @param string $name Input name
105
  * @param string $label Input Label
106
  * @param array $args
 
 
107
  */
108
- static function field( $type, $name = '', $label = '', $args = array() ) {
 
 
 
 
 
 
 
109
  switch ( $type ) {
110
  case 'checkbox':
111
- $checked = ( get_option( $name ) === 'true' ) ? 'checked' : '';
112
  ob_start();
113
  ?>
114
  <tr valign="middle">
115
- <th><?php echo $label ?></th>
 
116
  <td>
117
- <!--suppress HtmlFormInputWithoutLabel -->
118
  <input type="checkbox" id="<?php echo $name ?>"
119
- name="<?php echo $name ?>" <?php echo $checked ?> />
120
  </td>
121
  </tr>
122
  <?php
123
  ob_end_flush();
124
  break;
125
  case 'select' :
126
-
127
- $option = get_option( $name );
128
- if( empty($option) && $name == 'wpemfb_sdk_version' )
129
- $option = 'v2.6';
130
  ob_start();
131
  ?>
132
  <tr valign="middle">
133
- <th><?php echo $label ?></th>
134
  <td>
135
  <!--suppress HtmlFormInputWithoutLabel -->
136
- <select name="<?php echo $name ?>">
137
  <?php foreach ( $args as $value => $name ) : ?>
138
  <option
139
  value="<?php echo $value ?>" <?php echo $option == $value ? 'selected' : '' ?>><?php echo $name ?></option>
@@ -144,6 +153,21 @@ class WP_Embed_FB_Admin {
144
  <?php
145
  ob_end_flush();
146
  break;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
147
  case 'string' :
148
  ob_start();
149
  ?>
@@ -166,7 +190,7 @@ class WP_Embed_FB_Admin {
166
  <input id="<?php echo $name ?>"
167
  type="<?php echo $type ?>"
168
  name="<?php echo $name ?>" <?php echo isset( $args['required'] ) ? 'required' : '' ?>
169
- value="<?php echo get_option( $name ) ?>" size="38"/>
170
  </td>
171
  </tr>
172
  <?php
@@ -175,62 +199,49 @@ class WP_Embed_FB_Admin {
175
  }
176
  }
177
 
178
- /**
179
- * Saves $_POST values to the database
180
- *
181
- * @param $option string option name
182
- * @param $type string direct or true/false
183
- */
184
- static function save_option( $option, $type ) {
185
- if ( $type == 'direct' ) {
186
- if ( isset( $_POST[ $option ] ) ) {
187
- update_option( $option, sanitize_text_field( $_POST[ $option ] ) );
188
- }
189
- } elseif ( $type == 'bool' ) {
190
- if ( isset( $_POST[ $option ] ) ) {
191
- update_option( $option, 'true' );
192
- } else {
193
- update_option( $option, 'false' );
194
- }
195
- }
196
- }
197
-
198
  /**
199
  * Gets $_POST variables and saves them to the database
200
  */
201
  static function savedata() {
202
- if ( isset( $_POST['wpemfb_app_secret'], $_POST['wpemfb_app_id'] ) ) {
203
- $options = WP_Embed_FB_Plugin::getdefaults();
204
-
205
  foreach ( $options as $option => $value ) {
206
  if ( $value == 'true' || $value == 'false' ) {
207
- $type = 'bool';
 
 
 
 
208
  } else {
209
- $type = 'direct';
 
 
210
  }
211
- self::save_option( $option, $type );
212
- }
213
- if ( isset( $_POST['wpemfb_max_width'] ) && is_int( $_POST['wpemfb_max_width'] ) ) {
214
- $prop = get_option( 'wpemfb_proportions' ) * $_POST['wpemfb_max_width'];
215
  }
 
216
  }
217
- /**
218
- * Save extra options, requires coordination with 'wpemfb_options' action
219
- *
220
- * @since 1.8
221
- *
222
- */
223
- do_action( 'wpemfb_admin_save_data' );
224
  }
225
 
226
  /**
227
  * Renders the wp-admin settings page
228
  */
229
  static function wpemfb_page() {
230
- if ( isset( $_POST['save-data'] ) && wp_verify_nonce( $_POST['save-data'], 'wp-embed-facebook' ) ) {
231
  self::savedata();
232
  }
 
 
 
233
  ?>
 
 
 
 
 
 
 
 
 
234
  <div class="wrap">
235
  <h2>WP Embed Facebook</h2>
236
 
@@ -239,14 +250,15 @@ class WP_Embed_FB_Admin {
239
  <div class="welcome-panel-column-container">
240
  <div class="welcome-panel-column settings-col">
241
  <form id="config-form" action="#" method="post">
242
- <?php wp_nonce_field( 'wp-embed-facebook', 'save-data' ); ?>
243
  <?php
244
- $tabs = array(
 
245
  __( 'General', 'wp-embed-facebook' ),
246
  __( 'Custom Embeds', 'wp-embed-facebook' ),
247
  __( 'Geeky Stuff', 'wp-embed-facebook' ),
248
  );
249
- $tabs = apply_filters( 'wpemfb_tabs', $tabs );
250
  ?>
251
  <h2 class="nav-tab-wrapper">
252
  <?php
@@ -259,25 +271,24 @@ class WP_Embed_FB_Admin {
259
  <section class="sections">
260
  <?php
261
  self::section( __( 'For all embeds', 'wp-embed-facebook' ) );
262
- self::field( 'number', 'wpemfb_max_width', __( 'Maximum width in pixels', 'wp-embed-facebook' ) );
263
- self::field( 'select', 'wpemfb_sdk_lang', __( 'Like Buttons Language', 'wp-embed-facebook' ), WP_Embed_FB_Plugin::get_fb_locales() );
264
  self::section();
265
- echo '<img style="float: left; margin: 42px 10px 0px;" src="'.WP_Embed_FB_Plugin::get_url().'lib/admin/ic_image_settings.png">';
266
  ?>
267
 
268
  <?php
269
  self::section( __( 'Video Social Plugin Settings', 'wp-embed-facebook' ) );
270
- self::field( 'checkbox', 'wpemfb_video_download', __( 'Show download option under video', 'wp-embed-facebook' ) );
271
- self::field( 'checkbox', 'wpemfb_video_as_post', __( 'Embed Video as Post', 'wp-embed-facebook' ) );
272
  self::section();
273
  self::section( __( 'Page Social Plugin Settings', 'wp-embed-facebook' ) );
274
- self::field( 'checkbox', 'wpemfb_page_show_faces', __( "Show Friend's Faces", 'wp-embed-facebook' ) );
275
- self::field( 'checkbox', 'wpemfb_page_small_header', __( 'Use Small Header', 'wp-embed-facebook' ) );
276
- self::field( 'checkbox', 'wpemfb_page_hide_cover', __( 'Hide Cover Photo', 'wp-embed-facebook' ) );
277
- self::field( 'checkbox', 'wpemfb_page_show_posts', __( 'Show Page Posts', 'wp-embed-facebook' ) );
278
- self::field( 'number', 'wpemfb_page_height', __( 'Maximum height in pixels', 'wp-embed-facebook' ) );
279
  self::section();
280
- if ( ! WP_Embed_FB_Plugin::has_fb_app() ) :
281
  ?>
282
  <p>
283
  <?php _e( 'By default you can only embed public pages, videos, photos and posts.', 'wp-embed-facebook' ) ?>
@@ -291,66 +302,81 @@ class WP_Embed_FB_Admin {
291
  </p>
292
  <?php
293
  self::section( __( 'Facebook credentials', 'wp-embed-facebook' ) );
294
- self::field( 'text', 'wpemfb_app_id', __( 'App ID', 'wp-embed-facebook' ) );
295
- self::field( 'text', 'wpemfb_app_secret', __( 'App Secret', 'wp-embed-facebook' ) );
296
  self::section();
297
  ?>
298
 
299
  </section>
300
  <section class="sections">
301
  <?php
302
- if(WP_Embed_FB_Plugin::has_fb_app()){
303
- self::section( __( "General", 'wp-embed-facebook' ) );
304
- /**
305
- * Filter available templates
306
- * @since 2.0.2
307
- */
308
- $templates = apply_filters( 'wpemfb_admin_theme', array(
309
- 'default' => 'Default',
310
- 'classic' => 'Classic'
311
- ) );
312
- self::field( 'select', 'wpemfb_theme', 'Template to use', $templates );
313
- self::section();
314
- self::section( __( "Albums", 'wp-embed-facebook' ) );
315
- self::field( 'number', 'wpemfb_max_photos', __( 'Number of Photos', 'wp-embed-facebook' ) );
316
- self::section();
317
- self::section( __( "Events", 'wp-embed-facebook' ) );
318
- self::field( 'checkbox', 'wpemfb_ev_local_tz', __( 'Use WordPress timezone string to calculate the date', 'wp-embed-facebook' ) );
319
- self::section();
320
- self::section( __( "Pages", 'wp-embed-facebook' ) );
321
- self::field( 'checkbox', 'wpemfb_raw_page', __( 'Use custom embed by default', 'wp-embed-facebook' ) );
322
- self::field( 'checkbox', 'wpemfb_show_like', __( 'Show like button', 'wp-embed-facebook' ) );
323
- self::field( 'number', 'wpemfb_max_posts', __( 'Number of posts', 'wp-embed-facebook' ) );
324
- self::section();
325
- self::section( __( "Photo", 'wp-embed-facebook' ) );
326
- self::field( 'checkbox', 'wpemfb_raw_photo', __( 'Use custom embed by default', 'wp-embed-facebook' ) );
327
- self::section();
328
- self::section( __( "Posts", 'wp-embed-facebook' ) );
329
- self::field( 'checkbox', 'wpemfb_raw_post', __( 'Use custom embed by default', 'wp-embed-facebook' ) );
330
- self::section();
331
- self::section( __( "Videos", 'wp-embed-facebook' ) );
332
- self::field( 'checkbox', 'wpemfb_raw_video', __( 'Use custom embed by default', 'wp-embed-facebook' ) );
333
- self::field( 'checkbox', 'wpemfb_video_ratio', __( 'Force 16:9 ratio', 'wp-embed-facebook' ) );
334
- self::section();
335
- self::section( __( "Profiles", 'wp-embed-facebook' ) );
336
- self::field( 'checkbox', 'wpemfb_show_follow', __( 'Show follow button', 'wp-embed-facebook' ) );
337
- self::section();
338
- } else {
339
- echo "<br><p>You need a facebook app to use custom embeds</p>";
340
- }
341
  ?>
342
 
343
  </section>
344
  <?php do_action( 'wpemfb_options' ); ?>
345
  <section class="sections">
346
  <?php
347
- self::section( __( 'Advanced ', 'wp-embed-facebook' ) );
348
- self::field( 'checkbox', 'wpemfb_enqueue_style', __( 'Enqueue Styles', 'wp-embed-facebook' ) );
349
- self::field( 'checkbox', 'wpemfb_fb_root', __( 'Add fb-root on top of content', 'wp-embed-facebook' ) );
350
- self::field( 'checkbox', 'wpemfb_enq_lightbox', __( 'Enqueue Lightbox script', 'wp-embed-facebook' ) );
351
- self::field( 'checkbox', 'wpemfb_enq_wpemfb', __( 'Enqueue WPEmbedFB script', 'wp-embed-facebook' ) );
352
- self::field( 'checkbox', 'wpemfb_enq_fbjs', __( 'Enqueue Facebook SDK', 'wp-embed-facebook' ) );
353
- self::field( 'checkbox', 'wpemfb_force_app_token', __( 'Force app token', 'wp-embed-facebook' ) );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
354
  $versions = array(
355
  'v2.0' => '2.0',
356
  'v2.1' => '2.1',
@@ -360,35 +386,47 @@ class WP_Embed_FB_Admin {
360
  'v2.5' => '2.5',
361
  'v2.6' => '2.6',
362
  );
363
- self::field( 'select', 'wpemfb_sdk_version', 'SDK Version', $versions );
364
  self::section();
365
  ?>
 
366
  </section>
367
- <input type="hidden" name="wpemfb_close_warning2" value="true">
368
  <input type="submit" name="submit" class="button button-primary alignright"
369
  value="<?php _e( 'Save', 'wp-embed-facebook' ) ?>"/>
370
 
371
- <p><?php _e( 'All options can be overwritten using the [facebook url ]', 'wp-embed-facebook' ) ?>
372
- <a href="http://www.wpembedfb.com/documentation">shortcode</a></p>
373
  <br>
374
  <br>
375
  </form>
 
 
 
 
 
 
 
 
376
  </div>
377
  <div class="welcome-panel-column welcome-panel-last">
378
  <?php ob_start(); ?>
379
  <h1><?php _e( 'Premium Extension Available', 'wp-embed-facebook' ) ?></h1>
380
  <br>
 
381
  <div class="features-list">
382
  <p><?php _e( 'Shortcodes for embedding a full event or page.', 'wp-embed-facebook' ) ?></p>
383
 
384
  <p><?php _e( 'Default event template shows admins and address.', 'wp-embed-facebook' ) ?></p>
 
385
  <p><?php _e( 'Albums with more that 100 photos.', 'wp-embed-facebook' ) ?></p>
386
 
387
  <p><?php _e( 'One Year Premium Support', 'wp-embed-facebook' ) ?></p>
 
388
  <p>
389
  <a class="button button-red"
390
- href="http://www.wpembedfb.com/premium"><?php _e( 'Check it out', 'wp-embed-facebook' ) ?></a>
391
  </p>
 
392
  <p>
393
  <?php _e( 'Plus new features cooking', 'wp-embed-facebook' ) ?>
394
  <br>
@@ -402,9 +440,10 @@ class WP_Embed_FB_Admin {
402
 
403
  <p>
404
  <strong>
405
- <a href="http://wordpress.org/plugins/wp-embed-facebook">Rate it<br>
 
406
  <span style="color: gold;"> &#9733;&#9733;&#9733;&#9733;&#9733; </span>
407
- </a>
408
  </strong>
409
  </p>
410
 
1
  <?php
2
+
3
  class WP_Embed_FB_Admin {
4
  /**
5
  * Add WP Embed Facebook page to Settings
20
  if ( $hook_suffix == 'settings_page_embedfacebook' ) {
21
  wp_enqueue_style( 'wpemfb-admin-css', WP_Embed_FB_Plugin::get_url() . 'lib/admin/admin.css' );
22
  }
23
+ wp_enqueue_style( 'wpemfb-default', WP_Embed_FB_Plugin::get_url() . 'templates/default/default.css', array(), false );
24
+ wp_enqueue_style( 'wpemfb-classic', WP_Embed_FB_Plugin::get_url() . 'templates/classic/classic.css', array(), false );
25
+ wp_enqueue_style( 'wpemfb-lightbox', WP_Embed_FB_Plugin::get_url() . 'lib/lightbox2/css/lightbox.css', array(), false );
26
  }
27
+
28
+ static function in_admin_footer() {
29
  global $hook_suffix;
30
  ob_start();
31
+ if ( $hook_suffix == 'settings_page_embedfacebook' ) :
32
  ?>
33
  <script type="text/javascript">
34
+ jQuery(document).ready(function () {
35
  var sections = jQuery('section');
36
  sections.first().show();
37
  jQuery(".nav-tab-wrapper a").on('click', function (event) {
47
  </script>
48
  <?php
49
  endif;
50
+ if ( WP_Embed_FB_Plugin::get_option( 'close_warning2' ) == 'false' ) :
51
  ?>
52
  <script type="text/javascript">
53
+ jQuery(document).on('click', '.wpemfb_warning .notice-dismiss', function () {
54
+ jQuery.post(ajaxurl, {action: 'wpemfb_close_warning'});
55
  });
56
+ jQuery(document).on('click', '#wef-video-down', function (e) {
57
  e.preventDefault();
58
+ jQuery.post(ajaxurl, {action: 'wpemfb_video_down'}, function () {
59
  window.location = "<?php echo admin_url("options-general.php?page=embedfacebook"); ?>"
60
  });
61
 
66
  echo ob_get_clean();
67
  }
68
 
69
+ static function add_action_link( $links ) {
70
+ array_unshift( $links, '<a href="' . admin_url( "options-general.php?page=embedfacebook" ) . '">' . __( "Settings" ) . '</a>' );
71
+
72
  return $links;
73
  }
74
 
76
  * Add template editor style to the embeds.
77
  */
78
  static function admin_init() {
79
+ $theme = WP_Embed_FB_Plugin::get_option( 'theme' );
80
  add_editor_style( WP_Embed_FB_Plugin::get_url() . '/templates/' . $theme . '/' . $theme . '.css' );
81
  }
82
 
107
  * @param string $name Input name
108
  * @param string $label Input Label
109
  * @param array $args
110
+ * @param array $atts Embed attributes
111
+ * TODO add $help = null
112
  */
113
+ static function field( $type, $name = '', $label = '', $args = array(), $atts = array() ) {
114
+ $options = WP_Embed_FB_Plugin::get_option();
115
+ $attsString = '';
116
+ if ( ! empty( $atts ) ) {
117
+ foreach ( $atts as $att => $val ) {
118
+ $attsString .= $att . '="' . $val . '" ';
119
+ }
120
+ }
121
  switch ( $type ) {
122
  case 'checkbox':
123
+ $checked = ( $options[ $name ] === 'true' ) ? 'checked' : '';
124
  ob_start();
125
  ?>
126
  <tr valign="middle">
127
+ <th<?php echo ( $name == 'video_download' ) ? ' style="width: 60%;"' : '' ?>><label
128
+ for="<?php echo $name ?>"><?php echo $label ?></label></th>
129
  <td>
 
130
  <input type="checkbox" id="<?php echo $name ?>"
131
+ name="<?php echo $name ?>" <?php echo $checked ?> <?php echo $attsString ?>/>
132
  </td>
133
  </tr>
134
  <?php
135
  ob_end_flush();
136
  break;
137
  case 'select' :
138
+ $option = $options[ $name ];
 
 
 
139
  ob_start();
140
  ?>
141
  <tr valign="middle">
142
+ <th><label for="<?php echo $name ?>"><?php echo $label ?></label></th>
143
  <td>
144
  <!--suppress HtmlFormInputWithoutLabel -->
145
+ <select name="<?php echo $name ?>" <?php echo $attsString ?>>
146
  <?php foreach ( $args as $value => $name ) : ?>
147
  <option
148
  value="<?php echo $value ?>" <?php echo $option == $value ? 'selected' : '' ?>><?php echo $name ?></option>
153
  <?php
154
  ob_end_flush();
155
  break;
156
+ case 'number' :
157
+ ob_start();
158
+ ?>
159
+ <tr valign="middle">
160
+ <th><label for="<?php echo $name ?>"><?php echo $label ?></label></th>
161
+ <td>
162
+ <input id="<?php echo $name ?>"
163
+ type="<?php echo $type ?>"
164
+ name="<?php echo $name ?>" <?php echo isset( $args['required'] ) ? 'required' : '' ?>
165
+ value="<?php echo $options[ $name ] ?>" <?php echo $attsString ?>/>
166
+ </td>
167
+ </tr>
168
+ <?php
169
+ ob_end_flush();
170
+ break;
171
  case 'string' :
172
  ob_start();
173
  ?>
190
  <input id="<?php echo $name ?>"
191
  type="<?php echo $type ?>"
192
  name="<?php echo $name ?>" <?php echo isset( $args['required'] ) ? 'required' : '' ?>
193
+ value="<?php echo $options[ $name ] ?>" <?php echo $attsString ?>/>
194
  </td>
195
  </tr>
196
  <?php
199
  }
200
  }
201
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
202
  /**
203
  * Gets $_POST variables and saves them to the database
204
  */
205
  static function savedata() {
206
+ if ( isset( $_POST['app_secret'], $_POST['app_id'] ) ) {
207
+ $options = WP_Embed_FB_Plugin::get_option();
 
208
  foreach ( $options as $option => $value ) {
209
  if ( $value == 'true' || $value == 'false' ) {
210
+ if ( isset( $_POST[ $option ] ) ) {
211
+ $options[ $option ] = 'true';
212
+ } else {
213
+ $options[ $option ] = 'false';
214
+ }
215
  } else {
216
+ if ( isset( $_POST[ $option ] ) ) {
217
+ $options[ $option ] = sanitize_text_field( $_POST[ $option ] );
218
+ }
219
  }
 
 
 
 
220
  }
221
+ WP_Embed_FB_Plugin::set_options( $options );
222
  }
 
 
 
 
 
 
 
223
  }
224
 
225
  /**
226
  * Renders the wp-admin settings page
227
  */
228
  static function wpemfb_page() {
229
+ if ( isset( $_POST['save-data'] ) && wp_verify_nonce( $_POST['save-data'], 'W7ziLKoLoj' ) ) {
230
  self::savedata();
231
  }
232
+ if ( isset( $_POST['restore-data'] ) && wp_verify_nonce( $_POST['restore-data'], 'W7ziLKoLojka' ) ) {
233
+ WP_Embed_FB_Plugin::set_options( WP_Embed_FB_Plugin::get_defaults() );
234
+ }
235
  ?>
236
+ <style>
237
+ input[type="text"], input[type="search"], input[type="password"], input[type="email"], input[type="number"], tr, tbody, table, select {
238
+ width: 100%;
239
+ }
240
+
241
+ th {
242
+ min-width: 40%;
243
+ }
244
+ </style>
245
  <div class="wrap">
246
  <h2>WP Embed Facebook</h2>
247
 
250
  <div class="welcome-panel-column-container">
251
  <div class="welcome-panel-column settings-col">
252
  <form id="config-form" action="#" method="post">
253
+ <?php wp_nonce_field( 'W7ziLKoLoj', 'save-data' ); ?>
254
  <?php
255
+ $has_app = WP_Embed_FB_Plugin::has_fb_app();
256
+ $tabs = array(
257
  __( 'General', 'wp-embed-facebook' ),
258
  __( 'Custom Embeds', 'wp-embed-facebook' ),
259
  __( 'Geeky Stuff', 'wp-embed-facebook' ),
260
  );
261
+ $tabs = apply_filters( 'wpemfb_tabs', $tabs );
262
  ?>
263
  <h2 class="nav-tab-wrapper">
264
  <?php
271
  <section class="sections">
272
  <?php
273
  self::section( __( 'For all embeds', 'wp-embed-facebook' ) );
274
+ self::field( 'number', 'max_width', __( 'Maximum width in pixels', 'wp-embed-facebook' ), array(), array( 'min' => '0' ) );
275
+ self::field( 'select', 'sdk_lang', __( 'Like Buttons Language', 'wp-embed-facebook' ), WP_Embed_FB_Plugin::get_fb_locales() );
276
  self::section();
 
277
  ?>
278
 
279
  <?php
280
  self::section( __( 'Video Social Plugin Settings', 'wp-embed-facebook' ) );
281
+ self::field( 'checkbox', 'video_download', sprintf( __( '%sShow download option under video', 'wp-embed-facebook' ), '<img style="display:block;float:left;padding-right:5px;" src="' . WP_Embed_FB_Plugin::get_url() . 'lib/admin/ic_image_settings.png">' ) );
282
+ self::field( 'checkbox', 'video_as_post', __( 'Embed Video as Post', 'wp-embed-facebook' ) );
283
  self::section();
284
  self::section( __( 'Page Social Plugin Settings', 'wp-embed-facebook' ) );
285
+ self::field( 'checkbox', 'page_show_faces', __( "Show Friend's Faces", 'wp-embed-facebook' ) );
286
+ self::field( 'checkbox', 'page_small_header', __( 'Use Small Header', 'wp-embed-facebook' ) );
287
+ self::field( 'checkbox', 'page_hide_cover', __( 'Hide Cover Photo', 'wp-embed-facebook' ) );
288
+ self::field( 'checkbox', 'page_show_posts', __( 'Show Page Posts', 'wp-embed-facebook' ) );
289
+ self::field( 'number', 'page_height', __( 'Maximum height in pixels', 'wp-embed-facebook' ), array(), array( 'min' => '0' ) );
290
  self::section();
291
+ if ( ! $has_app ) :
292
  ?>
293
  <p>
294
  <?php _e( 'By default you can only embed public pages, videos, photos and posts.', 'wp-embed-facebook' ) ?>
302
  </p>
303
  <?php
304
  self::section( __( 'Facebook credentials', 'wp-embed-facebook' ) );
305
+ self::field( 'text', 'app_id', __( 'App ID', 'wp-embed-facebook' ) );
306
+ self::field( 'text', 'app_secret', __( 'App Secret', 'wp-embed-facebook' ) );
307
  self::section();
308
  ?>
309
 
310
  </section>
311
  <section class="sections">
312
  <?php
313
+ echo ! $has_app ? '<div style="display: none">' : '';
314
+ self::section( __( "General", 'wp-embed-facebook' ) );
315
+ /**
316
+ * Filter available templates
317
+ * @since 2.0.2
318
+ */
319
+ $templates = apply_filters( 'wpemfb_admin_theme', array(
320
+ 'default' => 'Default',
321
+ 'classic' => 'Classic'
322
+ ) );
323
+ self::field( 'select', 'theme', 'Template', $templates );
324
+ self::section();
325
+ self::section( __( "Albums", 'wp-embed-facebook' ) );
326
+ self::field( 'number', 'max_photos', __( 'Number of Photos', 'wp-embed-facebook' ), array(), array( 'min' => '0' ) );
327
+ self::section();
328
+ self::section( __( "Events", 'wp-embed-facebook' ) );
329
+ self::field( 'checkbox', 'ev_local_tz', __( 'Use WordPress timezone string to calculate the date', 'wp-embed-facebook' ) );
330
+ self::section();
331
+ self::section( __( "Pages", 'wp-embed-facebook' ) );
332
+ self::field( 'checkbox', 'raw_page', __( 'Enable by default', 'wp-embed-facebook' ) );
333
+ self::field( 'checkbox', 'show_like', __( 'Show like button', 'wp-embed-facebook' ) );
334
+ self::field( 'number', 'max_posts', __( 'Number of posts', 'wp-embed-facebook' ), array(), array( 'min' => '0' ) );
335
+ self::section();
336
+ self::section( __( "Photos", 'wp-embed-facebook' ) );
337
+ self::field( 'checkbox', 'raw_photo', __( 'Enable by default', 'wp-embed-facebook' ) );
338
+ self::section();
339
+ self::section( __( "Posts", 'wp-embed-facebook' ) );
340
+ self::field( 'checkbox', 'raw_post', __( 'Enable by default', 'wp-embed-facebook' ) );
341
+ self::section();
342
+ self::section( __( "Videos", 'wp-embed-facebook' ) );
343
+ self::field( 'checkbox', 'raw_video', __( 'Enable by default', 'wp-embed-facebook' ) );
344
+ self::field( 'checkbox', 'video_ratio', __( 'Force 16:9 ratio', 'wp-embed-facebook' ) );
345
+ self::section();
346
+ self::section( __( "Profiles", 'wp-embed-facebook' ) );
347
+ self::field( 'checkbox', 'show_follow', __( 'Show follow button', 'wp-embed-facebook' ) );
348
+ self::section();
349
+ echo ! $has_app ? '</div><br><p>You need a facebook app to use custom embeds</p>' : '';
 
 
350
  ?>
351
 
352
  </section>
353
  <?php do_action( 'wpemfb_options' ); ?>
354
  <section class="sections">
355
  <?php
356
+ self::section( __( "Lightbox Options", 'wp-embed-facebook' ) );
357
+ self::field( 'checkbox', 'LB_showImageNumberLabel', __( 'Show Image Number Label', 'wp-embed-facebook' ) );
358
+ self::field( 'text', 'LB_albumLabel', __( 'Album Label', 'wp-embed-facebook' ) );
359
+ self::field( 'number', 'LB_fadeDuration', __( 'Fade Duration', 'wp-embed-facebook' ), array(), array( 'min' => '0' ) );
360
+ self::field( 'number', 'LB_resizeDuration', __( 'Resize Duration', 'wp-embed-facebook' ), array(), array( 'min' => '0' ) );
361
+ self::field( 'number', 'LB_positionFromTop', __( 'Position From Top', 'wp-embed-facebook' ), array(), array( 'min' => '0' ) );
362
+ self::field( 'number', 'LB_maxHeight', __( 'Max Height', 'wp-embed-facebook' ), array(), array( 'min' => '0' ) );
363
+ self::field( 'number', 'LB_maxWidth', __( 'Max Width', 'wp-embed-facebook' ), array(), array( 'min' => '0' ) );
364
+ self::field( 'checkbox', 'LB_alwaysShowNavOnTouchDevices', __( 'Always Show Nav On TouchDevices', 'wp-embed-facebook' ) );
365
+ self::field( 'checkbox', 'LB_fitImagesInViewport', __( 'Fit Images In Viewport', 'wp-embed-facebook' ) );
366
+ self::field( 'checkbox', 'LB_disableScrolling', __( 'Disable Scrolling', 'wp-embed-facebook' ) );
367
+ self::field( 'checkbox', 'LB_wrapAround', __( 'Loop Through Album', 'wp-embed-facebook' ) );
368
+ self::section();
369
+ self::section( __( 'Enqueue styles and scripts', 'wp-embed-facebook' ) );
370
+ self::field( 'checkbox', 'enq_when_needed', __( 'Only when there is an embed present', 'wp-embed-facebook' ) );
371
+ self::field( 'checkbox', 'enq_fbjs', __( 'Facebook SDK', 'wp-embed-facebook' ) );
372
+ self::field( 'checkbox', 'enqueue_style', __( 'Template Styles', 'wp-embed-facebook' ) );
373
+ self::field( 'checkbox', 'enq_wpemfb', __( 'Adaptive social plugins script', 'wp-embed-facebook' ) );
374
+ self::field( 'checkbox', 'enq_lightbox', __( 'Lightbox Script', 'wp-embed-facebook' ) );
375
+ self::section();
376
+ self::section( __( 'Other Options' ) );
377
+ self::field( 'checkbox', 'fb_root', __( 'Add fb-root on top of content', 'wp-embed-facebook' ) );
378
+ self::field( 'checkbox', 'enq_fbjs_global', __( 'Force Facebook SDK script on all site', 'wp-embed-facebook' ) );
379
+ self::field( 'checkbox', 'force_app_token', __( 'Force app token', 'wp-embed-facebook' ) );
380
  $versions = array(
381
  'v2.0' => '2.0',
382
  'v2.1' => '2.1',
386
  'v2.5' => '2.5',
387
  'v2.6' => '2.6',
388
  );
389
+ self::field( 'select', 'sdk_version', 'Facebook SDK Version', $versions );
390
  self::section();
391
  ?>
392
+ <input type="hidden" name="close_warning2" value="true">
393
  </section>
 
394
  <input type="submit" name="submit" class="button button-primary alignright"
395
  value="<?php _e( 'Save', 'wp-embed-facebook' ) ?>"/>
396
 
397
+ <p><?php sprintf( __( 'All options can be overwritten using the [facebook url ] <a href="%s">shortcode</a>', 'wp-embed-facebook' ), 'http://www.wpembedfb.com/shortcode-attributes-and-examples/' ) ?>
398
+ </p>
399
  <br>
400
  <br>
401
  </form>
402
+ <form method="post"
403
+ onsubmit="return confirm('<?php _e( 'Restore default values?', 'wp-embed-facebook' ) ?>');">
404
+ <input type="submit" name="restore" class="button alignleft"
405
+ value="<?php _e( 'Restore defaults', 'wp-embed-facebook' ) ?>"/>
406
+ <br>
407
+ <?php wp_nonce_field( 'W7ziLKoLojka', 'restore-data' ); ?>
408
+ <br>
409
+ </form>
410
  </div>
411
  <div class="welcome-panel-column welcome-panel-last">
412
  <?php ob_start(); ?>
413
  <h1><?php _e( 'Premium Extension Available', 'wp-embed-facebook' ) ?></h1>
414
  <br>
415
+
416
  <div class="features-list">
417
  <p><?php _e( 'Shortcodes for embedding a full event or page.', 'wp-embed-facebook' ) ?></p>
418
 
419
  <p><?php _e( 'Default event template shows admins and address.', 'wp-embed-facebook' ) ?></p>
420
+
421
  <p><?php _e( 'Albums with more that 100 photos.', 'wp-embed-facebook' ) ?></p>
422
 
423
  <p><?php _e( 'One Year Premium Support', 'wp-embed-facebook' ) ?></p>
424
+
425
  <p>
426
  <a class="button button-red"
427
+ href="http://www.wpembedfb.com/premium"><?php _e( 'Check it out', 'wp-embed-facebook' ) ?></a>
428
  </p>
429
+
430
  <p>
431
  <?php _e( 'Plus new features cooking', 'wp-embed-facebook' ) ?>
432
  <br>
440
 
441
  <p>
442
  <strong>
443
+ <a href="http://wordpress.org/plugins/wp-embed-facebook"><?php _e( "Rate it", 'wp-embed-facebook' ) ?>
444
+ <br>
445
  <span style="color: gold;"> &#9733;&#9733;&#9733;&#9733;&#9733; </span>
446
+ </a>
447
  </strong>
448
  </p>
449
 
lib/class-wp-embed-fb-plugin.php CHANGED
@@ -1,4 +1,5 @@
1
  <?php
 
2
  class WP_Embed_FB_Plugin {
3
  /**
4
  * @var string Plugin directory
@@ -8,182 +9,343 @@ class WP_Embed_FB_Plugin {
8
  * @var string Plugin url
9
  */
10
  private static $url = null;
11
- static function install(){
12
- $defaults = self::getdefaults();
13
- foreach ($defaults as $option => $value) {
14
- $opt = get_option($option);
15
- if($opt === false)
16
- update_option($option, $value);
17
- if(!isset($type))
18
- $type = $opt==false?"activated":"reactivated";
19
- }
20
 
21
- /** @noinspection PhpUndefinedVariableInspection */
 
 
22
 
23
- return self::whois($type);
24
  }
 
25
  /**
26
  * Delete all plugin options on uninstall
27
  */
28
- static function uninstall(){
29
- $deprecated = array('wpemfb_show_posts'=>'','wpemfb_close_warning'=>'','wpemfb_height'=>'','wpemfb_close_warning1'=>'');
30
- $defaults = self::getdefaults() + $deprecated;
31
  if ( is_multisite() ) {
32
  $sites = wp_get_sites();
33
- foreach ($sites as $site) {
34
- switch_to_blog($site['blog_id']);
35
- foreach ($defaults as $option => $value ) {
36
- delete_option($option);
37
- }
38
  }
39
  restore_current_blog();
40
  } else {
41
- foreach ($defaults as $option => $value ) {
42
- delete_option($option);
43
- }
44
  }
45
- return self::whois('uninstalled');
 
46
  }
47
- static function deactivate(){
48
- return self::whois('deactivated');
 
49
  }
 
50
  /**
51
- * @return array plugin defaults
52
  */
53
- static function getdefaults(){
54
- $locale = get_locale();
55
- if(strpos($locale,'es_') !== false)
56
- $locale = 'es_LA';
57
- return array(
58
- 'wpemfb_max_width' => '450',
59
- 'wpemfb_max_photos' => '24',
60
- 'wpemfb_max_posts' => '0',
61
- 'wpemfb_app_id' => '',
62
- 'wpemfb_app_secret' => '',
63
- 'wpemfb_proportions' => 0.36867,
64
- 'wpemfb_show_like' => 'true',
65
- 'wpemfb_fb_root' => 'true',
66
- 'wpemfb_theme' => 'default',
67
- 'wpemfb_show_follow' => 'true',
68
- 'wpemfb_video_ratio' => 'false',
69
- 'wpemfb_video_as_post' => 'false',
70
- 'wpemfb_raw_video' => 'false',
71
- 'wpemfb_raw_photo' => 'false',
72
- 'wpemfb_raw_post' => 'false',
73
- 'wpemfb_raw_page' => 'false',
74
- 'wpemfb_enqueue_style' => 'true',
75
- 'wpemfb_enq_lightbox' => 'true',
76
- 'wpemfb_enq_wpemfb' => 'true',
77
- 'wpemfb_enq_fbjs' => 'true',
78
- 'wpemfb_ev_local_tz' => 'false',
79
- 'wpemfb_page_height' => '500',
80
- 'wpemfb_page_show_faces' => 'true',
81
- 'wpemfb_page_small_header' => 'false',
82
- 'wpemfb_page_hide_cover' => 'false',
83
- 'wpemfb_page_show_posts' => 'false',
84
- 'wpemfb_sdk_lang' => array_key_exists( $locale, self::get_fb_locales()) ? $locale : 'en_US',
85
- 'wpemfb_close_warning2' => 'false',
86
- 'wpemfb_force_app_token' => 'true',
87
- 'wpemfb_video_download' => 'false',
88
- 'wpemfb_sdk_version' => 'v2.6',
89
- );
 
90
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
91
  //("uninstalled","deactivated","activated","reactivated")
92
- protected static function whois($install){
93
  $home = home_url();
94
- $home = esc_url($home);
95
- @file_get_contents("http://www.wpembedfb.com/api/?whois=$install&site_url=$home");
 
96
  return true;
97
  }
 
98
  /**
99
  * session start if necessary
100
  */
101
- static function init(){
102
- if( self::has_fb_app() ){
103
- if(version_compare(phpversion(), '5.4.0', '<')) {
104
- if(session_id() == '')
105
  session_start();
106
- } elseif(session_status() == PHP_SESSION_NONE) {
 
107
  session_start();
108
  }
109
  }
110
  }
 
111
  /**
112
  * Load translation file
113
  */
114
- static function plugins_loaded(){
115
  load_plugin_textdomain( 'wp-embed-facebook', false, 'wp-embed-facebook/lang' );
116
  }
 
117
  /**
118
  * Enqueue wp embed facebook styles
119
  */
120
- static function wp_enqueue_scripts(){
121
- if(get_option('wpemfb_enqueue_style') == 'true'){
122
- wp_register_style('wpemfb-default',self::get_url().'templates/default/default.css',array(),false);
123
- wp_register_style('wpemfb-classic',self::get_url().'templates/classic/classic.css',array(),false);
124
- // do_action('wpemfb_register_style');
125
- $theme = get_option('wpemfb_theme');
126
- wp_enqueue_style('wpemfb-'.$theme);
127
- wp_enqueue_style('wpemfb-lightbox', self::get_url().'lib/lightbox2/css/lightbox.min.css',array(),false);
 
 
 
 
 
 
 
 
128
  }
129
- if(get_option('wpemfb_enq_lightbox') == 'true'){
130
- wp_enqueue_script(
131
- 'wpemfb-lightbox',
132
- self::get_url().'lib/lightbox2/js/lightbox.min.js',
133
- array( 'jquery' )
134
- );
135
  }
136
- if(get_option('wpemfb_enq_wpemfb') == 'true'){
137
- wp_enqueue_script(
138
- 'wpemfb',
139
- self::get_url().'lib/js/wpembedfb.js',
140
- array( 'jquery' )
141
- );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
142
  }
143
- if(get_option('wpemfb_enq_fbjs') == 'true'){
144
- wp_enqueue_script(
145
- 'wpemfb-fbjs',
146
- self::get_url().'lib/js/fb.js',
147
- array( 'jquery' )
148
- );
149
- $translation_array = array(
150
- 'local' => get_option('wpemfb_sdk_lang','en_US'),
151
- 'version' => get_option('wpemfb_sdk_version','v2.6'),
152
- 'fb_id'=>get_option('wpemfb_app_id') == '0' ? '' : get_option('wpemfb_app_id'));
153
- wp_localize_script( 'wpemfb-fbjs', 'WEF', $translation_array );
154
  }
155
  }
156
- static function get_path(){
157
- if(self::$path){
 
158
  return self::$path;
159
  } else {
160
- self::$path = dirname(plugin_dir_path( __FILE__ )).'/';
 
161
  return self::$path;
162
  }
163
  }
164
- static function get_url(){
165
- if(self::$url){
 
166
  return self::$url;
167
  } else {
168
- self::$url = dirname(plugin_dir_url( __FILE__ )).'/';
 
169
  return self::$url;
170
  }
171
  }
172
- static function admin_notices(){
173
- if( (get_option('wpemfb_close_warning2','false') == 'false')) :
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
174
  ?>
175
  <div class="notice wpemfb_warning is-dismissible">
176
  <h2>WP Embed Facebook</h2>
 
177
  <p>Hey! The last step.</p>
178
- <p><img style="position:relative; top: 5px;" height="20px" width="auto" src="<?php echo WP_Embed_FB_Plugin::get_url().'lib/admin/ic_setting.png' ?>">&nbsp;Turn on <a id="wef-video-down" href="<?php echo admin_url("options-general.php?page=embedfacebook") ?>">Video Download Option</a> in settings.</p>
 
 
 
 
179
  <small>
180
  <?php
181
- printf(__('To embed albums, events, profiles and video as HTML5 you will need a <a target="_blank" href="%s">Facebook App</a>','wp-embed-facebook'), 'https://developers.facebook.com/apps')
182
  ?>
183
  </small>
184
  <p>
185
  <?php
186
- printf(__('This free plugin has taken <strong>thousands of hours</strong> to develop and maintain consider making a <a target="_blank" href="%s">donation</a> or leaving a <a target="_blank" href="%s">review</a> <strong>do not let us loose faith</strong> in humanity.','wp-embed-facebook'), 'https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=R8Q85GT3Q8Q26','https://wordpress.org/support/view/plugin-reviews/wp-embed-facebook')
187
  ?>
188
  </p>
189
 
@@ -191,167 +353,205 @@ class WP_Embed_FB_Plugin {
191
  <?php
192
  endif;
193
  }
194
- static function wpemfb_close_warning(){
195
- if(current_user_can('manage_options'))
196
- update_option('wpemfb_close_warning2','true');
 
 
 
 
197
  die;
198
  }
199
- static function wpemfb_video_down(){
200
- if(current_user_can('manage_options')){
201
- update_option('wpemfb_close_warning2','true');
202
- update_option('wpemfb_video_download','true');
 
 
 
203
  }
204
  die;
205
  }
206
- static function has_fb_app(){
207
- $app_id = get_option('wpemfb_app_id');
208
- $app_secret = get_option('wpemfb_app_secret');
209
- if(empty($app_id) || empty($app_id) || $app_id === '0' || $app_secret === '0' ){
 
210
  return false;
211
- } else {
212
  return true;
213
  }
214
  }
215
- static function get_fb_locales(){
 
 
 
 
 
 
 
 
 
 
 
 
 
216
  return array(
217
- 'af_ZA'=>'Afrikaans',
218
- 'ak_GH'=>'Akan',
219
- 'am_ET'=>'Amharic',
220
- 'ar_AR'=>'Arabic',
221
- 'as_IN'=>'Assamese',
222
- 'ay_BO'=>'Aymara',
223
- 'az_AZ'=>'Azerbaijani',
224
- 'be_BY'=>'Belarusian',
225
- 'bg_BG'=>'Bulgarian',
226
- 'bn_IN'=>'Bengali',
227
- 'br_FR'=>'Breton',
228
- 'bs_BA'=>'Bosnian',
229
- 'ca_ES'=>'Catalan',
230
- 'cb_IQ'=>'Sorani Kurdish',
231
- 'ck_US'=>'Cherokee',
232
- 'co_FR'=>'Corsican',
233
- 'cs_CZ'=>'Czech',
234
- 'cx_PH'=>'Cebuano',
235
- 'cy_GB'=>'Welsh',
236
- 'da_DK'=>'Danish',
237
- 'de_DE'=>'German',
238
- 'el_GR'=>'Greek',
239
- 'en_GB'=>'English (UK)',
240
- 'en_IN'=>'English (India)',
241
- 'en_PI'=>'English (Pirate)',
242
- 'en_UD'=>'English (Upside Down)',
243
- 'en_US'=>'English (US)',
244
- 'eo_EO'=>'Esperanto',
245
- 'es_CL'=>'Spanish (Chile)',
246
- 'es_CO'=>'Spanish (Colombia)',
247
- 'es_ES'=>'Spanish (Spain)',
248
- 'es_LA'=>'Spanish',
249
- 'es_MX'=>'Spanish (Mexico)',
250
- 'es_VE'=>'Spanish (Venezuela)',
251
- 'et_EE'=>'Estonian',
252
- 'eu_ES'=>'Basque',
253
- 'fa_IR'=>'Persian',
254
- 'fb_LT'=>'Leet Speak',
255
- 'ff_NG'=>'Fulah',
256
- 'fi_FI'=>'Finnish',
257
- 'fo_FO'=>'Faroese',
258
- 'fr_CA'=>'French (Canada)',
259
- 'fr_FR'=>'French (France)',
260
- 'fy_NL'=>'Frisian',
261
- 'ga_IE'=>'Irish',
262
- 'gl_ES'=>'Galician',
263
- 'gn_PY'=>'Guarani',
264
- 'gu_IN'=>'Gujarati',
265
- 'gx_GR'=>'Classical Greek',
266
- 'ha_NG'=>'Hausa',
267
- 'he_IL'=>'Hebrew',
268
- 'hi_IN'=>'Hindi',
269
- 'hr_HR'=>'Croatian',
270
- 'hu_HU'=>'Hungarian',
271
- 'hy_AM'=>'Armenian',
272
- 'id_ID'=>'Indonesian',
273
- 'ig_NG'=>'Igbo',
274
- 'is_IS'=>'Icelandic',
275
- 'it_IT'=>'Italian',
276
- 'ja_JP'=>'Japanese',
277
- 'ja_KS'=>'Japanese (Kansai)',
278
- 'jv_ID'=>'Javanese',
279
- 'ka_GE'=>'Georgian',
280
- 'kk_KZ'=>'Kazakh',
281
- 'km_KH'=>'Khmer',
282
- 'kn_IN'=>'Kannada',
283
- 'ko_KR'=>'Korean',
284
- 'ku_TR'=>'Kurdish (Kurmanji)',
285
- 'la_VA'=>'Latin',
286
- 'lg_UG'=>'Ganda',
287
- 'li_NL'=>'Limburgish',
288
- 'ln_CD'=>'Lingala',
289
- 'lo_LA'=>'Lao',
290
- 'lt_LT'=>'Lithuanian',
291
- 'lv_LV'=>'Latvian',
292
- 'mg_MG'=>'Malagasy',
293
- 'mk_MK'=>'Macedonian',
294
- 'ml_IN'=>'Malayalam',
295
- 'mn_MN'=>'Mongolian',
296
- 'mr_IN'=>'Marathi',
297
- 'ms_MY'=>'Malay',
298
- 'mt_MT'=>'Maltese',
299
- 'my_MM'=>'Burmese',
300
- 'nb_NO'=>'Norwegian (bokmal)',
301
- 'nd_ZW'=>'Ndebele',
302
- 'ne_NP'=>'Nepali',
303
- 'nl_BE'=>'Dutch (België)',
304
- 'nl_NL'=>'Dutch',
305
- 'nn_NO'=>'Norwegian (nynorsk)',
306
- 'ny_MW'=>'Chewa',
307
- 'or_IN'=>'Oriya',
308
- 'pa_IN'=>'Punjabi',
309
- 'pl_PL'=>'Polish',
310
- 'ps_AF'=>'Pashto',
311
- 'pt_BR'=>'Portuguese (Brazil)',
312
- 'pt_PT'=>'Portuguese (Portugal)',
313
- 'qu_PE'=>'Quechua',
314
- 'rm_CH'=>'Romansh',
315
- 'ro_RO'=>'Romanian',
316
- 'ru_RU'=>'Russian',
317
- 'rw_RW'=>'Kinyarwanda',
318
- 'sa_IN'=>'Sanskrit',
319
- 'sc_IT'=>'Sardinian',
320
- 'se_NO'=>'Northern Sámi',
321
- 'si_LK'=>'Sinhala',
322
- 'sk_SK'=>'Slovak',
323
- 'sl_SI'=>'Slovenian',
324
- 'sn_ZW'=>'Shona',
325
- 'so_SO'=>'Somali',
326
- 'sq_AL'=>'Albanian',
327
- 'sr_RS'=>'Serbian',
328
- 'sv_SE'=>'Swedish',
329
- 'sw_KE'=>'Swahili',
330
- 'sy_SY'=>'Syriac',
331
- 'sz_PL'=>'Silesian',
332
- 'ta_IN'=>'Tamil',
333
- 'te_IN'=>'Telugu',
334
- 'tg_TJ'=>'Tajik',
335
- 'th_TH'=>'Thai',
336
- 'tk_TM'=>'Turkmen',
337
- 'tl_PH'=>'Filipino',
338
- 'tl_ST'=>'Klingon',
339
- 'tr_TR'=>'Turkish',
340
- 'tt_RU'=>'Tatar',
341
- 'tz_MA'=>'Tamazight',
342
- 'uk_UA'=>'Ukrainian',
343
- 'ur_PK'=>'Urdu',
344
- 'uz_UZ'=>'Uzbek',
345
- 'vi_VN'=>'Vietnamese',
346
- 'wo_SN'=>'Wolof',
347
- 'xh_ZA'=>'Xhosa',
348
- 'yi_DE'=>'Yiddish',
349
- 'yo_NG'=>'Yoruba',
350
- 'zh_CN'=>'Simplified Chinese (China)',
351
- 'zh_HK'=>'Traditional Chinese (Hong Kong)',
352
- 'zh_TW'=>'Traditional Chinese (Taiwan)',
353
- 'zu_ZA'=>'Zulu',
354
- 'zz_TR'=>'Zazaki',
355
  );
356
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
357
  }
1
  <?php
2
+
3
  class WP_Embed_FB_Plugin {
4
  /**
5
  * @var string Plugin directory
9
  * @var string Plugin url
10
  */
11
  private static $url = null;
12
+ private static $options = null;
13
+ private static $defaults = null;
14
+ const option_name = 'wpemfb_options';
15
+ private static $lb_defaults = null;
16
+ private static $has_photon = null;
17
+ private static $wp_timezone = null;
 
 
 
18
 
19
+ static function install() {
20
+ $type = ( get_option( 'wpemfb_theme' ) || get_option( self::option_name ) ) ? 'reactivated' : 'activated';
21
+ self::get_option();
22
 
23
+ return self::whois( $type );
24
  }
25
+
26
  /**
27
  * Delete all plugin options on uninstall
28
  */
29
+ static function uninstall() {
 
 
30
  if ( is_multisite() ) {
31
  $sites = wp_get_sites();
32
+ foreach ( $sites as $site ) {
33
+ switch_to_blog( $site['blog_id'] );
34
+ delete_option( self::option_name );
 
 
35
  }
36
  restore_current_blog();
37
  } else {
38
+ delete_option( self::option_name );
 
 
39
  }
40
+
41
+ return self::whois( 'uninstalled' );
42
  }
43
+
44
+ static function deactivate() {
45
+ return self::whois( 'deactivated' );
46
  }
47
+
48
  /**
49
+ * @return array old options to be deleated since 2.1
50
  */
51
+ static function old_options() {
52
+ return apply_filters( 'wpemfb_old_options', array(
53
+ 'show_posts',
54
+ 'close_warning',
55
+ 'height',
56
+ 'close_warning1',
57
+ 'max_width',
58
+ 'max_photos',
59
+ 'max_posts',
60
+ 'app_id',
61
+ 'app_secret',
62
+ 'proportions',
63
+ 'show_like',
64
+ 'fb_root',
65
+ 'theme',
66
+ 'show_follow',
67
+ 'video_ratio',
68
+ 'video_as_post',
69
+ 'raw_video',
70
+ 'raw_photo',
71
+ 'raw_post',
72
+ 'raw_page',
73
+ 'enqueue_style',
74
+ 'enq_lightbox',
75
+ 'enq_wpemfb',
76
+ 'enq_fbjs',
77
+ 'ev_local_tz',
78
+ 'page_height',
79
+ 'page_show_faces',
80
+ 'page_small_header',
81
+ 'page_hide_cover',
82
+ 'page_show_posts',
83
+ 'sdk_lang',
84
+ 'close_warning2',
85
+ 'force_app_token',
86
+ 'video_download',
87
+ 'sdk_version'
88
+ ) );
89
  }
90
+
91
+ static function get_defaults() {
92
+ if ( self::$defaults === null ) {
93
+ $locale = get_locale();
94
+ if ( strpos( $locale, 'es_' ) !== false ) {
95
+ $locale = 'es_LA';
96
+ }
97
+
98
+ self::$defaults = array(
99
+ 'sdk_lang' => array_key_exists( $locale, self::get_fb_locales() ) ? $locale : 'en_US',
100
+ 'max_width' => '450',
101
+ 'max_photos' => '24',
102
+ 'max_posts' => '0',
103
+ 'app_id' => '',
104
+ 'app_secret' => '',
105
+ 'theme' => 'default',
106
+ 'page_height' => '500',
107
+ 'sdk_version' => 'v2.6',
108
+ 'show_like' => 'true',
109
+ 'fb_root' => 'true',
110
+ 'show_follow' => 'true',
111
+ 'video_ratio' => 'false',
112
+ 'video_as_post' => 'false',
113
+ 'raw_video' => 'false',
114
+ 'raw_photo' => 'false',
115
+ 'raw_post' => 'false',
116
+ 'raw_page' => 'false',
117
+ 'enqueue_style' => 'true',
118
+ 'enq_lightbox' => 'true',
119
+ 'enq_wpemfb' => 'true',
120
+ 'enq_fbjs' => 'true',
121
+ 'ev_local_tz' => 'false',
122
+ 'page_show_faces' => 'true',
123
+ 'page_small_header' => 'false',
124
+ 'page_hide_cover' => 'false',
125
+ 'page_show_posts' => 'false',
126
+ 'close_warning2' => 'false',
127
+ 'force_app_token' => 'true',
128
+ 'video_download' => 'false',
129
+ 'LB_albumLabel' => 'Image %1 of %2',
130
+ 'LB_alwaysShowNavOnTouchDevices' => 'false',
131
+ 'LB_showImageNumberLabel' => 'true',
132
+ 'LB_wrapAround' => 'false',
133
+ 'LB_disableScrolling' => 'false',
134
+ 'LB_fitImagesInViewport' => 'true',
135
+ 'LB_maxWidth' => '0',
136
+ 'LB_maxHeight' => '0',
137
+ 'LB_positionFromTop' => '50',
138
+ 'LB_resizeDuration' => '700',
139
+ 'LB_fadeDuration' => '500',
140
+ 'enq_fbjs_global' => 'false',
141
+ 'enq_when_needed' => 'false',
142
+ );
143
+ }
144
+
145
+ return apply_filters( 'wpemfb_defaults', self::$defaults );
146
+ }
147
+
148
+ static function get_lb_defaults() {
149
+ if ( self::$lb_defaults === null ) {
150
+ $keys = array(
151
+ 'albumLabel',
152
+ 'alwaysShowNavOnTouchDevices',
153
+ 'showImageNumberLabel',
154
+ 'wrapAround',
155
+ 'disableScrolling',
156
+ 'fitImagesInViewport',
157
+ 'maxWidth',
158
+ 'maxHeight',
159
+ 'positionFromTop',
160
+ 'resizeDuration',
161
+ 'fadeDuration'
162
+ );
163
+ self::$lb_defaults = array();
164
+ $defaults = self::get_defaults();
165
+ foreach ( $keys as $key ) {
166
+ self::$lb_defaults[ $key ] = $defaults[ 'LB_' . $key ];
167
+ }
168
+ }
169
+
170
+ return self::$lb_defaults;
171
+ }
172
+
173
  //("uninstalled","deactivated","activated","reactivated")
174
+ protected static function whois( $install ) {
175
  $home = home_url();
176
+ $home = esc_url( $home );
177
+ @file_get_contents( "http://www.wpembedfb.com/api/?whois=$install&site_url=$home" );
178
+
179
  return true;
180
  }
181
+
182
  /**
183
  * session start if necessary
184
  */
185
+ static function init() {
186
+ if ( self::has_fb_app() ) {
187
+ if ( version_compare( phpversion(), '5.4.0', '<' ) ) {
188
+ if ( session_id() == '' ) {
189
  session_start();
190
+ }
191
+ } elseif ( session_status() == PHP_SESSION_NONE ) {
192
  session_start();
193
  }
194
  }
195
  }
196
+
197
  /**
198
  * Load translation file
199
  */
200
+ static function plugins_loaded() {
201
  load_plugin_textdomain( 'wp-embed-facebook', false, 'wp-embed-facebook/lang' );
202
  }
203
+
204
  /**
205
  * Enqueue wp embed facebook styles
206
  */
207
+ static function wp_enqueue_scripts() {
208
+ wp_register_style( 'wpemfb-default', self::get_url() . 'templates/default/default.css', array(), false );
209
+ wp_register_style( 'wpemfb-classic', self::get_url() . 'templates/classic/classic.css', array(), false );
210
+ wp_register_style( 'wpemfb-lightbox', self::get_url() . 'lib/lightbox2/css/lightbox.css', array(), false );
211
+ wp_register_script(
212
+ 'wpemfb-lightbox',
213
+ self::get_url() . 'lib/lightbox2/js/lightbox.min.js',
214
+ array( 'jquery' )
215
+ );
216
+ $lb_defaults = self::get_lb_defaults();
217
+ $options = self::get_option();
218
+ $translation_array = array();
219
+ foreach ( $lb_defaults as $default_name => $value ) {
220
+ if ( $options[ 'LB_' . $default_name ] !== $value ) {
221
+ $translation_array[ $default_name ] = $options[ 'LB_' . $default_name ];
222
+ }
223
  }
224
+ if ( ! empty( $translation_array ) ) {
225
+ wp_localize_script( 'wpemfb-lightbox', 'WEF_LB', $translation_array );
 
 
 
 
226
  }
227
+ wp_register_script(
228
+ 'wpemfb',
229
+ self::get_url() . 'lib/js/wpembedfb.min.js',
230
+ array( 'jquery' )
231
+ );
232
+ wp_register_script(
233
+ 'wpemfb-fbjs',
234
+ self::get_url() . 'lib/js/fb.min.js',
235
+ array( 'jquery' )
236
+ );
237
+ $translation_array = array(
238
+ 'local' => WP_Embed_FB_Plugin::get_option( 'sdk_lang' ),
239
+ 'version' => WP_Embed_FB_Plugin::get_option( 'sdk_version' ),
240
+ 'fb_id' => WP_Embed_FB_Plugin::get_option( 'app_id' ) == '0' ? '' : WP_Embed_FB_Plugin::get_option( 'app_id' )
241
+ );
242
+ wp_localize_script( 'wpemfb-fbjs', 'WEF', $translation_array );
243
+ if ( WP_Embed_FB_Plugin::get_option( 'enq_when_needed' ) == 'false' ) {
244
+ if ( WP_Embed_FB_Plugin::get_option( 'enq_lightbox' ) == 'true' ) {
245
+ wp_enqueue_script( 'wpemfb-lightbox' );
246
+ wp_enqueue_style( 'wpemfb-lightbox' );
247
+ }
248
+ if ( WP_Embed_FB_Plugin::get_option( 'enq_wpemfb' ) == 'true' ) {
249
+ wp_enqueue_script( 'wpemfb' );
250
+ }
251
+ if ( WP_Embed_FB_Plugin::get_option( 'enq_fbjs' ) == 'true' ) {
252
+ wp_enqueue_script( 'wpemfb-fbjs' );
253
+ }
254
  }
255
+ if ( WP_Embed_FB_Plugin::get_option( 'enq_fbjs_global' ) == 'true' ) {
256
+ wp_enqueue_script( 'wpemfb-fbjs' );
 
 
 
 
 
 
 
 
 
257
  }
258
  }
259
+
260
+ static function get_path() {
261
+ if ( self::$path ) {
262
  return self::$path;
263
  } else {
264
+ self::$path = dirname( plugin_dir_path( __FILE__ ) ) . '/';
265
+
266
  return self::$path;
267
  }
268
  }
269
+
270
+ static function get_url() {
271
+ if ( self::$url ) {
272
  return self::$url;
273
  } else {
274
+ self::$url = dirname( plugin_dir_url( __FILE__ ) ) . '/';
275
+
276
  return self::$url;
277
  }
278
  }
279
+
280
+ static function get_option( $option = null ) {
281
+ if ( ! is_array( self::$options ) ) {
282
+ $options = get_option( self::option_name );
283
+ $defaults = self::get_defaults();
284
+ if ( is_array( $options ) ) {
285
+ if ( $options == $defaults ) {
286
+ self::$options = $options;
287
+ } else {
288
+ //check option array for corruption
289
+ $compare = array();
290
+ foreach ( $defaults as $default_key => $default_value ) {
291
+ $compare[ $default_key ] = isset( $options[ $default_key ] ) ? $options[ $default_key ] : $default_value;
292
+ }
293
+ if ( $compare !== $options ) {
294
+ self::set_options( $compare );
295
+ } else {
296
+ //set cache value
297
+ self::$options = $options;
298
+ }
299
+ }
300
+ } else {
301
+ if ( get_option( 'wpemfb_theme' ) ) {
302
+ //upgrade options
303
+ foreach ( self::old_options() as $old_option ) {
304
+ if ( isset( $defaults[ $old_option ] ) ) {
305
+ $defaults[ $old_option ] = get_option( 'wpemfb_' . $old_option );
306
+ }
307
+ delete_option( 'wpemfb_' . $old_option );
308
+ }
309
+ self::set_options( $defaults );
310
+ } else {
311
+ //new instalation
312
+ //TODO get app id and secret from other plugins Jetpack and WP Social Login.
313
+ self::set_options( $defaults );
314
+ }
315
+ }
316
+ }
317
+ if ( $option ) {
318
+ return isset( self::$options[ $option ] ) ? self::$options[ $option ] : false;
319
+ } else {
320
+ return self::$options;
321
+ }
322
+ }
323
+
324
+ static function set_options( $options ) {
325
+ update_option( self::option_name, $options, true );
326
+ self::$options = $options;
327
+ }
328
+
329
+ static function admin_notices() {
330
+ if ( ( WP_Embed_FB_Plugin::get_option( 'close_warning2' ) == 'false' ) ) :
331
  ?>
332
  <div class="notice wpemfb_warning is-dismissible">
333
  <h2>WP Embed Facebook</h2>
334
+
335
  <p>Hey! The last step.</p>
336
+
337
+ <p><img style="position:relative; top: 5px;" height="20px" width="auto"
338
+ src="<?php echo WP_Embed_FB_Plugin::get_url() . 'lib/admin/ic_setting.png' ?>">&nbsp;Turn on <a
339
+ id="wef-video-down" href="<?php echo admin_url( "options-general.php?page=embedfacebook" ) ?>">Video
340
+ Download Option</a> in settings.</p>
341
  <small>
342
  <?php
343
+ printf( __( 'To embed albums, events, profiles and video as HTML5 you will need a <a target="_blank" href="%s">Facebook App</a>', 'wp-embed-facebook' ), 'https://developers.facebook.com/apps' )
344
  ?>
345
  </small>
346
  <p>
347
  <?php
348
+ printf( __( 'This free plugin has taken <strong>thousands of hours</strong> to develop and maintain consider making a <a target="_blank" href="%s">donation</a> or leaving a <a target="_blank" href="%s">review</a> <strong>do not let us loose faith</strong> in humanity.', 'wp-embed-facebook' ), 'https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=R8Q85GT3Q8Q26', 'https://wordpress.org/support/view/plugin-reviews/wp-embed-facebook' )
349
  ?>
350
  </p>
351
 
353
  <?php
354
  endif;
355
  }
356
+
357
+ static function wpemfb_close_warning() {
358
+ if ( current_user_can( 'manage_options' ) ) {
359
+ $options = self::get_option();
360
+ $options['close_warning2'] = 'true';
361
+ self::set_options( $options );
362
+ }
363
  die;
364
  }
365
+
366
+ static function wpemfb_video_down() {
367
+ if ( current_user_can( 'manage_options' ) ) {
368
+ $options = self::get_option();
369
+ $options['close_warning2'] = 'true';
370
+ $options['video_download'] = 'true';
371
+ self::set_options( $options );
372
  }
373
  die;
374
  }
375
+
376
+ static function has_fb_app() {
377
+ $app_id = WP_Embed_FB_Plugin::get_option( 'app_id' );
378
+ $app_secret = WP_Embed_FB_Plugin::get_option( 'app_secret' );
379
+ if ( empty( $app_id ) || empty( $app_secret ) || $app_id === '0' || $app_secret === '0' ) {
380
  return false;
381
+ } else {
382
  return true;
383
  }
384
  }
385
+
386
+ static function has_photon() {
387
+ if ( self::$has_photon === null ) {
388
+ if ( class_exists( 'Jetpack' ) && method_exists( 'Jetpack', 'get_active_modules' ) && in_array( 'photon', Jetpack::get_active_modules() ) ) {
389
+ self::$has_photon = true;
390
+ } else {
391
+ self::$has_photon = false;
392
+ }
393
+ }
394
+
395
+ return self::$has_photon;
396
+ }
397
+
398
+ static function get_fb_locales() {
399
  return array(
400
+ 'af_ZA' => 'Afrikaans',
401
+ 'ak_GH' => 'Akan',
402
+ 'am_ET' => 'Amharic',
403
+ 'ar_AR' => 'Arabic',
404
+ 'as_IN' => 'Assamese',
405
+ 'ay_BO' => 'Aymara',
406
+ 'az_AZ' => 'Azerbaijani',
407
+ 'be_BY' => 'Belarusian',
408
+ 'bg_BG' => 'Bulgarian',
409
+ 'bn_IN' => 'Bengali',
410
+ 'br_FR' => 'Breton',
411
+ 'bs_BA' => 'Bosnian',
412
+ 'ca_ES' => 'Catalan',
413
+ 'cb_IQ' => 'Sorani Kurdish',
414
+ 'ck_US' => 'Cherokee',
415
+ 'co_FR' => 'Corsican',
416
+ 'cs_CZ' => 'Czech',
417
+ 'cx_PH' => 'Cebuano',
418
+ 'cy_GB' => 'Welsh',
419
+ 'da_DK' => 'Danish',
420
+ 'de_DE' => 'German',
421
+ 'el_GR' => 'Greek',
422
+ 'en_GB' => 'English (UK)',
423
+ 'en_IN' => 'English (India)',
424
+ 'en_PI' => 'English (Pirate)',
425
+ 'en_UD' => 'English (Upside Down)',
426
+ 'en_US' => 'English (US)',
427
+ 'eo_EO' => 'Esperanto',
428
+ 'es_CL' => 'Spanish (Chile)',
429
+ 'es_CO' => 'Spanish (Colombia)',
430
+ 'es_ES' => 'Spanish (Spain)',
431
+ 'es_LA' => 'Spanish',
432
+ 'es_MX' => 'Spanish (Mexico)',
433
+ 'es_VE' => 'Spanish (Venezuela)',
434
+ 'et_EE' => 'Estonian',
435
+ 'eu_ES' => 'Basque',
436
+ 'fa_IR' => 'Persian',
437
+ 'fb_LT' => 'Leet Speak',
438
+ 'ff_NG' => 'Fulah',
439
+ 'fi_FI' => 'Finnish',
440
+ 'fo_FO' => 'Faroese',
441
+ 'fr_CA' => 'French (Canada)',
442
+ 'fr_FR' => 'French (France)',
443
+ 'fy_NL' => 'Frisian',
444
+ 'ga_IE' => 'Irish',
445
+ 'gl_ES' => 'Galician',
446
+ 'gn_PY' => 'Guarani',
447
+ 'gu_IN' => 'Gujarati',
448
+ 'gx_GR' => 'Classical Greek',
449
+ 'ha_NG' => 'Hausa',
450
+ 'he_IL' => 'Hebrew',
451
+ 'hi_IN' => 'Hindi',
452
+ 'hr_HR' => 'Croatian',
453
+ 'hu_HU' => 'Hungarian',
454
+ 'hy_AM' => 'Armenian',
455
+ 'id_ID' => 'Indonesian',
456
+ 'ig_NG' => 'Igbo',
457
+ 'is_IS' => 'Icelandic',
458
+ 'it_IT' => 'Italian',
459
+ 'ja_JP' => 'Japanese',
460
+ 'ja_KS' => 'Japanese (Kansai)',
461
+ 'jv_ID' => 'Javanese',
462
+ 'ka_GE' => 'Georgian',
463
+ 'kk_KZ' => 'Kazakh',
464
+ 'km_KH' => 'Khmer',
465
+ 'kn_IN' => 'Kannada',
466
+ 'ko_KR' => 'Korean',
467
+ 'ku_TR' => 'Kurdish (Kurmanji)',
468
+ 'la_VA' => 'Latin',
469
+ 'lg_UG' => 'Ganda',
470
+ 'li_NL' => 'Limburgish',
471
+ 'ln_CD' => 'Lingala',
472
+ 'lo_LA' => 'Lao',
473
+ 'lt_LT' => 'Lithuanian',
474
+ 'lv_LV' => 'Latvian',
475
+ 'mg_MG' => 'Malagasy',
476
+ 'mk_MK' => 'Macedonian',
477
+ 'ml_IN' => 'Malayalam',
478
+ 'mn_MN' => 'Mongolian',
479
+ 'mr_IN' => 'Marathi',
480
+ 'ms_MY' => 'Malay',
481
+ 'mt_MT' => 'Maltese',
482
+ 'my_MM' => 'Burmese',
483
+ 'nb_NO' => 'Norwegian (bokmal)',
484
+ 'nd_ZW' => 'Ndebele',
485
+ 'ne_NP' => 'Nepali',
486
+ 'nl_BE' => 'Dutch (België)',
487
+ 'nl_NL' => 'Dutch',
488
+ 'nn_NO' => 'Norwegian (nynorsk)',
489
+ 'ny_MW' => 'Chewa',
490
+ 'or_IN' => 'Oriya',
491
+ 'pa_IN' => 'Punjabi',
492
+ 'pl_PL' => 'Polish',
493
+ 'ps_AF' => 'Pashto',
494
+ 'pt_BR' => 'Portuguese (Brazil)',
495
+ 'pt_PT' => 'Portuguese (Portugal)',
496
+ 'qu_PE' => 'Quechua',
497
+ 'rm_CH' => 'Romansh',
498
+ 'ro_RO' => 'Romanian',
499
+ 'ru_RU' => 'Russian',
500
+ 'rw_RW' => 'Kinyarwanda',
501
+ 'sa_IN' => 'Sanskrit',
502
+ 'sc_IT' => 'Sardinian',
503
+ 'se_NO' => 'Northern Sámi',
504
+ 'si_LK' => 'Sinhala',
505
+ 'sk_SK' => 'Slovak',
506
+ 'sl_SI' => 'Slovenian',
507
+ 'sn_ZW' => 'Shona',
508
+ 'so_SO' => 'Somali',
509
+ 'sq_AL' => 'Albanian',
510
+ 'sr_RS' => 'Serbian',
511
+ 'sv_SE' => 'Swedish',
512
+ 'sw_KE' => 'Swahili',
513
+ 'sy_SY' => 'Syriac',
514
+ 'sz_PL' => 'Silesian',
515
+ 'ta_IN' => 'Tamil',
516
+ 'te_IN' => 'Telugu',
517
+ 'tg_TJ' => 'Tajik',
518
+ 'th_TH' => 'Thai',
519
+ 'tk_TM' => 'Turkmen',
520
+ 'tl_PH' => 'Filipino',
521
+ 'tl_ST' => 'Klingon',
522
+ 'tr_TR' => 'Turkish',
523
+ 'tt_RU' => 'Tatar',
524
+ 'tz_MA' => 'Tamazight',
525
+ 'uk_UA' => 'Ukrainian',
526
+ 'ur_PK' => 'Urdu',
527
+ 'uz_UZ' => 'Uzbek',
528
+ 'vi_VN' => 'Vietnamese',
529
+ 'wo_SN' => 'Wolof',
530
+ 'xh_ZA' => 'Xhosa',
531
+ 'yi_DE' => 'Yiddish',
532
+ 'yo_NG' => 'Yoruba',
533
+ 'zh_CN' => 'Simplified Chinese (China)',
534
+ 'zh_HK' => 'Traditional Chinese (Hong Kong)',
535
+ 'zh_TW' => 'Traditional Chinese (Taiwan)',
536
+ 'zu_ZA' => 'Zulu',
537
+ 'zz_TR' => 'Zazaki',
538
  );
539
  }
540
+
541
+ static function get_timezone() {
542
+ if ( self::$wp_timezone === null ) {
543
+ $tzstring = get_option( 'timezone_string', '' );
544
+ if ( empty($tzstring) ) {
545
+ $current_offset = get_option( 'gmt_offset', 0 );
546
+ if ( 0 == $current_offset ) {
547
+ $tzstring = 'Etc/GMT';
548
+ } else {
549
+ $tzstring = ( $current_offset < 0 ) ? 'Etc/GMT' . $current_offset : 'Etc/GMT+' . $current_offset;
550
+ }
551
+ }
552
+ self::$wp_timezone = $tzstring;
553
+ }
554
+
555
+ return self::$wp_timezone;
556
+ }
557
  }
lib/class-wp-embed-fb.php CHANGED
@@ -1,4 +1,5 @@
1
  <?php
 
2
  class WP_Embed_FB {
3
  /**
4
  * @var string Width of the current embed
@@ -24,132 +25,168 @@ class WP_Embed_FB {
24
  * @var null|Sigami_Facebook
25
  */
26
  private static $fbsdk = null;
27
- static function get_theme(){
28
- if(self::$theme){
 
29
  return self::$theme;
30
  } else {
31
- self::$theme = get_option('wpemfb_theme');
 
32
  return self::$theme;
33
  }
34
  }
35
- static function is_raw($type){
36
- if(self::$raw !== null){
 
37
  return self::$raw;
38
  } else {
39
- switch($type){
40
  case 'page':
41
  case 'photo':
42
  case 'post':
43
  case 'video':
44
- self::$raw = (get_option('wpemfb_raw_'.$type) == 'false') ? false : true;
45
  break;
46
  default:
47
  self::$raw = true;
48
  break;
49
  }
 
50
  return self::$raw;
51
  }
52
  }
53
- static function get_fbsdk(){
54
- if( self::$fbsdk && self::$fbsdk instanceof Sigami_Facebook){
55
- if( get_option('wpemfb_force_app_token','true') == 'true' )
56
- self::$fbsdk->setAccessToken(get_option('wpemfb_app_id').'|'.get_option('wpemfb_app_secret'));
 
 
 
57
  return self::$fbsdk;
58
  } else {
59
- if(!class_exists('FacebookApiException'))
60
  require_once "base_facebook.php";
 
61
  require_once "class-sigami-facebook.php";
62
- $config = array();
63
- $config['appId'] = get_option('wpemfb_app_id','');
64
- $config['secret'] = get_option('wpemfb_app_secret','');
65
  //$config['fileUpload'] = false; // optional
66
- self::$fbsdk = new Sigami_Facebook($config);
67
- if( get_option('wpemfb_force_app_token','true') == 'true' )
68
- self::$fbsdk->setAccessToken(get_option('wpemfb_app_id').'|'.get_option('wpemfb_app_secret'));
 
 
69
  return self::$fbsdk;
70
  }
71
  }
 
72
  /**
73
  * Run
74
- * @param array $match[2]=url without ' https://www.facebook.com/ '
 
75
  * @param string $url Original url
76
  * @param array $atts Attributes for the embed
 
77
  * @return string Embedded content
78
  *
79
  */
80
- static function fb_embed($match, $url=null, $atts=null ){
81
  $juice = $match[2];
82
- self::set_atts($atts);
83
- $type_and_id = apply_filters('wpemfb_type_id', self::get_type_and_id($juice,$url), $juice, $url) ;
84
- if(is_string($type_and_id))
85
- return $type_and_id;
86
- $return = self::print_embed($type_and_id['fb_id'],$type_and_id['type'],$juice);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
87
  self::clear_atts();
88
  return $return;
89
-
90
  }
 
91
  /**
92
  * @param string $juice facebook url without https://www.facebook.com
93
  * @param string $original Original url to return.
94
  *
95
  * @return array|string
96
  */
97
- static function get_type_and_id($juice,$original){
98
  $has_fb_app = WP_Embed_FB_Plugin::has_fb_app();
99
- if($has_fb_app)
100
  $fbsdk = self::get_fbsdk();
 
101
  $fb_id = null;
102
- $type = null;
103
- if (($pos = strpos($juice, "?")) !== FALSE) {
104
  $vars = array();
105
- parse_str(parse_url($juice, PHP_URL_QUERY), $vars);
106
- if(isset($vars['fbid']))
107
  $fb_id = $vars['fbid'];
108
- if(isset($vars['id']))
 
109
  $fb_id = $vars['id'];
110
- if(isset($vars['v'])) {
 
111
  $fb_id = $vars['v'];
112
- $type = 'video';
113
  }
114
- if(isset($vars['set'])){
115
- $setArray = explode('.', $vars['set']);
116
- $fb_id = $setArray[1];
117
- $type = 'album';
118
  }
119
- $juice = substr($juice, 0, $pos);
120
  }
121
- $juiceArray = explode('/',trim($juice,'/'));
122
- if(!$fb_id){
123
- $fb_id = end($juiceArray);
124
  }
125
- if(in_array('posts',$juiceArray)){
126
  $type = 'post';
127
- if($has_fb_app && (self::is_raw('post')) ){
128
- try{
129
  /** @noinspection PhpUndefinedVariableInspection */
130
- $data = $fbsdk->api('/'.$juiceArray[0].'?fields=id');
131
- $fb_id = $data['id'].'_'.$fb_id;
132
- } catch(FacebookApiException $e){
133
- $res = '<p><a href="'.$original.'" target="_blank" rel="nofollow">'.$original.'</a>';
134
- if(is_super_admin()){
135
  $error = $e->getResult();
136
- if(isset($error['error']['code']) && ($error['error']['code'] == '803') ){
137
- $res .= '<br><span style="color: #4a0e13">'.__('Error: Try embedding this post as a social plugin (only visible to super admins)','wp-embed-facebook').'</span>';
138
  } else {
139
- if(isset($error['error']['code']))
140
- $res .= '<br><span style="color: #4a0e13">'.__('Code').':&nbsp;'.$error['error']['code'].'&nbsp;in type</span>';
141
- $res .= '<br><span style="color: #4a0e13">'.__('Error').':&nbsp;'.$error['error']['message'].' (only visible to super admins)</span>';
 
142
  }
143
  }
144
  $res .= '</p>';
 
145
  return $res;
146
  }
147
  }
148
- }elseif(in_array('photos',$juiceArray) || in_array('photo.php',$juiceArray) ){
149
  $type = 'photo';
150
- }elseif(in_array('events',$juiceArray)){
151
  $type = 'event';
152
- }elseif(in_array('videos',$juiceArray)){
153
  $type = 'video';
154
  }
155
  /**
@@ -160,49 +197,54 @@ class WP_Embed_FB {
160
  * @param string $type the embed type.
161
  * @param array $clean url parts of the request.
162
  */
163
- $type = apply_filters('wpemfb_embed_type', $type, $juiceArray);
164
- if(!$type){
165
- if($has_fb_app){
166
- try{
167
  /** @noinspection PhpUndefinedVariableInspection */
168
- $metadata = $fbsdk->api('/'.$fb_id.'?metadata=1');
169
- $type = $metadata['metadata']['type'];
170
- } catch(FacebookApiException $e){
171
- $res = '<p><a href="https://www.facebook.com/'.$juice.'" target="_blank" rel="nofollow">https://www.facebook.com/'.$juice.'</a>';
172
- if(is_super_admin()){
173
  $error = $e->getResult();
174
- if(isset($error['error']['code']))
175
- $res .= '<br><span style="color: #4a0e13">'.__('Code').':&nbsp;'.$error['error']['code'].'&nbsp;'.$type.'</span>';
176
- $res .= '<br><span style="color: #4a0e13">'.__('Error').':&nbsp;'.$error['error']['message'].' (only visible to super admins)</span>';
 
177
  }
178
  $res .= '</p>';
 
179
  return $res;
180
  }
181
  } else {
182
  $type = 'page';
183
  }
184
  }
185
- if(!is_numeric($fb_id)){
186
- $fb_id_array = explode('-',$fb_id);
187
- if( !empty($fb_id_array) && is_int(end($fb_id_array)) ){
188
- $fb_id = end($fb_id_array);
189
  }
190
- $fb_id = str_replace(':0','',$fb_id);
191
  }
192
- $fb_id = apply_filters('wpemfb_embed_fb_id',$fb_id, $juiceArray);
193
- return array('type'=>$type,'fb_id'=>$fb_id);
 
194
  }
195
- static function print_embed($fb_id,$type,$juice){
196
- if(!self::is_raw($type)){
197
- $fb_data = array('social_plugin'=>true, 'link'=>$juice, 'type'=>$type);
 
198
  $template_name = 'social-plugin';
199
  } else {
200
- switch($type){
201
  case 'page' :
202
- $fb_data = self::fb_api_get($fb_id,$juice,$type);
203
- if(!self::valid_fb_data($fb_data))
204
  return $fb_data;
205
- if(isset($fb_data['is_community_page']) && $fb_data['is_community_page'] == "1"){
 
206
  $template_name = 'com-page';
207
  } else {
208
  $default = 'page';
@@ -225,9 +267,9 @@ class WP_Embed_FB {
225
  * @since 1.0
226
  *
227
  * @param string $default file full path
228
- * @param array $fb_data['category'] data from facebook
229
  */
230
- $template_name = apply_filters('wpemfb_category_template', $default, $fb_data['category']);
231
  }
232
  break;
233
  case 'photo' :
@@ -235,32 +277,39 @@ class WP_Embed_FB {
235
  case 'video' :
236
  case 'album' :
237
  case 'event' :
238
- $fb_data = self::fb_api_get($fb_id,$juice,$type);
239
  $template_name = $type;
240
  break;
241
  case 'user' :
242
- $fb_data = self::fb_api_get($fb_id,$juice,'profile');
243
  $template_name = 'profile';
244
  break;
245
  default :
246
- $fb_data = self::fb_api_get($fb_id,$juice,$type);
247
  $template_name = $type;
248
  break;
249
  }
250
  }
251
 
252
- if(!self::valid_fb_data($fb_data))
253
- return print_r($fb_data,true);
254
- $template = self::locate_template($template_name);
 
255
  //get default variables to use on templates
256
  /** @noinspection PhpUnusedLocalVariableInspection */
257
- $width = !empty(self::$width) ? self::$width : get_option('wpemfb_max_width');
258
  /** @noinspection PhpUnusedLocalVariableInspection */
259
- $prop = get_option('wpemfb_proportions');
260
  ob_start();
261
  //show embed post on admin
262
- if(is_admin() && isset($fb_data['social_plugin'])) : ?>
263
- <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_option('wpemfb_sdk_lang','en_US'); ?>/sdk.js#xfbml=1&version=<?php echo get_option('wpemfb_sdk_version','v2.6') ?>"; fjs.parentNode.insertBefore(js, fjs);}(document, 'script', 'facebook-jssdk'));</script>
 
 
 
 
 
 
 
264
  <?php endif;
265
  /**
266
  * Change the file to include on a certain embed.
@@ -270,50 +319,57 @@ class WP_Embed_FB {
270
  * @param string $template file full path
271
  * @param array $fb_data data from facebook
272
  */
273
- $template = apply_filters('wpemfb_template',$template,$fb_data,$type);
274
  /** @noinspection PhpIncludeInspection */
275
  include( $template );
276
- return preg_replace('/^\s+|\n|\r|\s+$/m', '', ob_get_clean());
 
277
  }
278
- static function valid_fb_data($fb_data){
279
- if(is_array($fb_data) && ( isset($fb_data['id']) || isset($fb_data['social_plugin']) ) )
 
280
  return true;
 
 
281
  return false;
282
  }
 
283
  /**
284
  * get data from fb using WP_Embed_FB::$fbsdk->api('/'.$fb_id) :)
285
  *
286
  * @param int $fb_id Facebook id
287
  * @param string $url Facebook url
 
288
  * @type string type of embed
289
  * @return array|string
290
  */
291
- static function fb_api_get($fb_id, $url, $type=""){
292
- if(WP_Embed_FB_Plugin::has_fb_app()){
293
  $fbsdk = self::get_fbsdk();
294
  try {
295
- switch($type){
296
  case 'album' :
297
- self::$num_photos = is_int(self::$num_photos) ? self::$num_photos : get_option("wpemfb_max_photos");
298
- $api_string = $fb_id.'?fields=name,id,from,description,count,photos.fields(name,picture,source,id).limit('.self::$num_photos.')';
299
  break;
300
  case 'page' :
301
- $num_posts = is_int(self::$num_posts) ? self::$num_posts : get_option("wpemfb_max_posts");
302
- $api_string = $fb_id.'?fields=name,picture,is_community_page,link,id,cover,category,website,likes,genre';
303
- if(intval($num_posts) > 0)
304
- $api_string .= ',posts.limit('.$num_posts.'){id,full_picture,type,via,source,parent_id,call_to_action,story,place,child_attachments,icon,created_time,message,description,caption,name,shares,link,picture,object_id,likes.limit(1).summary(true),comments.limit(1).summary(true)}';
 
305
  break;
306
  case 'video' :
307
- $api_string = $fb_id.'?fields=id,source,picture,from';
308
  break;
309
  case 'photo' :
310
- $api_string = $fb_id.'?fields=id,source,link,likes.limit(1).summary(true),comments.limit(1).summary(true)';
311
  break;
312
  case 'event' :
313
- $api_string = $fb_id.'?fields=id,name,start_time,end_time,owner,place,picture,timezone,cover';
314
  break;
315
  case 'post' :
316
- $api_string = $fb_id.'?fields=from{id,name,likes,link},id,full_picture,type,via,source,parent_id,call_to_action,story,place,child_attachments,icon,created_time,message,description,caption,name,shares,link,picture,object_id,likes.limit(1).summary(true),comments.limit(1).summary(true)';
317
  break;
318
  default :
319
  $api_string = $fb_id;
@@ -330,7 +386,7 @@ class WP_Embed_FB {
330
  * @param string $type The detected type of embed
331
  *
332
  */
333
- $fb_data = $fbsdk->api('v2.5/'.apply_filters('wpemfb_api_string',$api_string,$fb_id,$type));
334
  $api_string2 = '';
335
 
336
  /**
@@ -343,11 +399,11 @@ class WP_Embed_FB {
343
  * @param string $type The detected type of embed
344
  *
345
  */
346
- $api_string2 = apply_filters('wpemfb_2nd_api_string',$api_string2,$fb_data,$type);
347
 
348
- if(!empty($api_string2)){
349
- $extra_data = $fbsdk->api('/v2.5/'.$api_string2);
350
- $fb_data = array_merge($fb_data,$extra_data);
351
  }
352
  /**
353
  * Filter all data received from facebook.
@@ -357,122 +413,155 @@ class WP_Embed_FB {
357
  * @param array $fb_data the final result
358
  * @param string $type The detected type of embed
359
  */
360
- $fb_data = apply_filters('wpemfb_fb_data',$fb_data,$type);
361
 
362
- } catch(FacebookApiException $e) {
363
- $fb_data = '<p><a href="https://www.facebook.com/'.$url.'" target="_blank" rel="nofollow">https://www.facebook.com/'.$url.'</a>';
364
- if(is_super_admin()){
365
  $error = $e->getResult();
366
- $fb_data .= '<br><span style="color: #4a0e13">'.__('Error').':&nbsp;'.$error['error']['message'].' (only visible to super admins)</span>';
367
  }
368
  $fb_data .= '</p>';
369
  }
370
  } else {
371
- $fb_data = '<p><a href="https://www.facebook.com/'.$url.'" target="_blank" rel="nofollow">https://www.facebook.com/'.$url.'</a>';
372
- if(is_super_admin()){
373
- $fb_data .= '<br><span style="color: #4a0e13">'.sprintf(__('<small>To embed this type of content you need to setup a facebook app on <a href="%s" title="WP Embed Facebook Settings">settings</a></small>','wp-embed-facebook'),admin_url('options-general.php?page=embedfacebook')).'</span>';
374
  }
375
  $fb_data .= '</p>';
376
  }
377
 
378
  return $fb_data;
379
  }
 
380
  /**
381
  * Locate the template inside plugin or theme
382
  *
383
  * @param string $template_name Template file name
 
384
  * @return string Template location
385
  */
386
- static function locate_template($template_name){
387
- $theme = self::get_theme();
388
- $located = locate_template(array('plugins/wp-embed-facebook/'.$theme.'/'.$template_name.'.php'));
389
- $file = 'templates/'.$theme.'/'.$template_name.'.php';
390
- if(empty($located)){
391
- $located = WP_Embed_FB_Plugin::get_path().$file;
392
  }
 
393
  return $located;
394
  }
 
395
  /**
396
  * If a user has a lot of websites registered on fb this function will only link to the first one
 
397
  * @param string $urls separated by spaces
 
398
  * @return string first url
399
  */
400
- static function getwebsite($urls){
401
- $url = explode(' ',trim($urls));
402
- return strpos('http://',$url[0]) == false ? 'http://'.$url[0] : $url[0];
 
403
  }
 
404
  /**
405
  * Shortcode function
406
  * [facebook='url' width='600' raw='true' social_plugin='true' posts='2' ] width is optional
 
407
  * @param array $atts [0]=>url ['width']=>embed width ['raw']=>for videos and photos
 
408
  * @return string
409
  */
410
- static function shortcode($atts){
411
- if(!empty($atts) && isset($atts[0])){
412
- $clean = trim($atts[0],'=');
413
- if(is_int($clean)){
414
  $juice = $clean;
415
  $clean = "https://www.facebook.com/$juice";
416
  } else {
417
- if( strpos($clean,'facebook.com') === false )
418
- return "<p>".__("This is not a valid facebook url","wp-embed-facebook")." $clean </p>";
419
- $juice = str_replace(array('https:','http:','//facebook.com/','//m.facebook.com/','//facebook.com/','//www.facebook.com/'),'',$clean);
 
 
 
 
 
 
 
 
420
  }
421
- $embed = self::fb_embed(array('https','://www.facebook.com/',$juice),$clean,$atts);
 
422
  return $embed;
423
  }
 
424
  return '';
425
  }
426
- static function embed_register_handler($match, /** @noinspection PhpUnusedParameterInspection */
427
- $attr=null, $url=null, $atts=null){
428
- return self::fb_embed($match, $url, $atts);
 
 
 
429
  }
430
- static function make_clickable($text) {
431
- return wpautop(self::rel_nofollow(make_clickable($text)));
 
432
  }
 
433
  static function rel_nofollow( $text ) {
434
- $text = stripslashes($text);
435
- return preg_replace_callback('|<a (.+?)>|i', array(__CLASS__,'nofollow_callback'), $text);
 
436
  }
 
437
  static function nofollow_callback( $matches ) {
438
  $text = $matches[1];
439
- $text = str_replace(array(' rel="nofollow"', " rel='nofollow'"), '', $text);
 
440
  return "<a $text rel=\"nofollow\">";
441
  }
442
- static function set_atts($atts){
443
- if(isset($atts['width'])){
 
 
 
444
  self::$width = $atts['width'];
445
  }
446
- if(isset($atts['raw'])){
447
- if($atts['raw'] == 'true'){
448
  self::$raw = true;
449
- } else {
450
  self::$raw = false;
451
  }
452
  }
453
- if(isset($atts['social_plugin'])){
454
- if($atts['social_plugin'] == 'true'){
455
  self::$raw = false;
456
- } else {
457
  self::$raw = true;
458
  }
459
  }
460
- if(isset($atts['theme'])){
461
- wp_enqueue_style('wpemfb-'.$atts['theme'], WP_Embed_FB_Plugin::get_url().'templates/'.$atts['theme'].'/'.$atts['theme'].'.css',array(),false);
462
  self::$theme = $atts['theme'];
463
  }
464
- if(isset($atts['posts'])){
465
- self::$num_posts = intval($atts['posts']);
466
  }
467
- if(isset($atts['photos'])){
468
- self::$num_photos = intval($atts['photos']);
469
  }
470
  }
471
- static function clear_atts(){
 
472
  self::$width = self::$raw = self::$num_posts = self::$theme = self::$num_photos = null;
 
 
473
  }
474
- static function fb_root($content){
475
- return '<div id="fb-root"></div>'.PHP_EOL.$content;
476
- }
477
- }
478
 
 
 
 
 
1
  <?php
2
+
3
  class WP_Embed_FB {
4
  /**
5
  * @var string Width of the current embed
25
  * @var null|Sigami_Facebook
26
  */
27
  private static $fbsdk = null;
28
+
29
+ static function get_theme() {
30
+ if ( self::$theme ) {
31
  return self::$theme;
32
  } else {
33
+ self::$theme = WP_Embed_FB_Plugin::get_option( 'theme' );
34
+
35
  return self::$theme;
36
  }
37
  }
38
+
39
+ static function is_raw( $type ) {
40
+ if ( self::$raw !== null ) {
41
  return self::$raw;
42
  } else {
43
+ switch ( $type ) {
44
  case 'page':
45
  case 'photo':
46
  case 'post':
47
  case 'video':
48
+ self::$raw = ( WP_Embed_FB_Plugin::get_option( 'raw_' . $type ) == 'false' ) ? false : true;
49
  break;
50
  default:
51
  self::$raw = true;
52
  break;
53
  }
54
+
55
  return self::$raw;
56
  }
57
  }
58
+
59
+ static function get_fbsdk() {
60
+ if ( self::$fbsdk && self::$fbsdk instanceof Sigami_Facebook ) {
61
+ if ( WP_Embed_FB_Plugin::get_option( 'force_app_token' ) == 'true' ) {
62
+ self::$fbsdk->setAccessToken( WP_Embed_FB_Plugin::get_option( 'app_id' ) . '|' . WP_Embed_FB_Plugin::get_option( 'app_secret' ) );
63
+ }
64
+
65
  return self::$fbsdk;
66
  } else {
67
+ if ( ! class_exists( 'FacebookApiException' ) ) {
68
  require_once "base_facebook.php";
69
+ }
70
  require_once "class-sigami-facebook.php";
71
+ $config = array();
72
+ $config['appId'] = WP_Embed_FB_Plugin::get_option( 'app_id' );
73
+ $config['secret'] = WP_Embed_FB_Plugin::get_option( 'app_secret' );
74
  //$config['fileUpload'] = false; // optional
75
+ self::$fbsdk = new Sigami_Facebook( $config );
76
+ if ( WP_Embed_FB_Plugin::get_option( 'force_app_token' ) == 'true' ) {
77
+ self::$fbsdk->setAccessToken( WP_Embed_FB_Plugin::get_option( 'app_id' ) . '|' . WP_Embed_FB_Plugin::get_option( 'app_secret' ) );
78
+ }
79
+
80
  return self::$fbsdk;
81
  }
82
  }
83
+
84
  /**
85
  * Run
86
+ *
87
+ * @param array $match [2]=url without ' https://www.facebook.com/ '
88
  * @param string $url Original url
89
  * @param array $atts Attributes for the embed
90
+ *
91
  * @return string Embedded content
92
  *
93
  */
94
+ static function fb_embed( $match, $url = null, $atts = null ) {
95
  $juice = $match[2];
96
+ self::set_atts( $atts );
97
+ $type_and_id = apply_filters( 'wpemfb_type_id', self::get_type_and_id( $juice, $url ), $juice, $url );
98
+ if ( is_string( $type_and_id ) ) {
99
+ return $type_and_id;
100
+ }
101
+ if ( WP_Embed_FB_Plugin::get_option( 'enq_when_needed' ) == 'true' ) {
102
+ if($type_and_id['type'] == 'album'){
103
+ if ( WP_Embed_FB_Plugin::get_option( 'enq_lightbox' ) == 'true' ) {
104
+ wp_enqueue_script('wpemfb-lightbox');
105
+ wp_enqueue_style('wpemfb-lightbox');
106
+ }
107
+ }
108
+ if ( WP_Embed_FB_Plugin::get_option( 'enq_wpemfb' ) == 'true' ) {
109
+ wp_enqueue_script( 'wpemfb' );
110
+ }
111
+ if ( WP_Embed_FB_Plugin::get_option( 'enq_fbjs' ) == 'true' ) {
112
+ wp_enqueue_script( 'wpemfb-fbjs' );
113
+ }
114
+ }
115
+ if(self::is_raw($type_and_id['type'])){
116
+ wp_enqueue_style( 'wpemfb-' . self::get_theme() );
117
+ }
118
+ $return = self::print_embed( $type_and_id['fb_id'], $type_and_id['type'], $juice );
119
  self::clear_atts();
120
  return $return;
 
121
  }
122
+
123
  /**
124
  * @param string $juice facebook url without https://www.facebook.com
125
  * @param string $original Original url to return.
126
  *
127
  * @return array|string
128
  */
129
+ static function get_type_and_id( $juice, $original ) {
130
  $has_fb_app = WP_Embed_FB_Plugin::has_fb_app();
131
+ if ( $has_fb_app ) {
132
  $fbsdk = self::get_fbsdk();
133
+ }
134
  $fb_id = null;
135
+ $type = null;
136
+ if ( ( $pos = strpos( $juice, "?" ) ) !== false ) {
137
  $vars = array();
138
+ parse_str( parse_url( $juice, PHP_URL_QUERY ), $vars );
139
+ if ( isset( $vars['fbid'] ) ) {
140
  $fb_id = $vars['fbid'];
141
+ }
142
+ if ( isset( $vars['id'] ) ) {
143
  $fb_id = $vars['id'];
144
+ }
145
+ if ( isset( $vars['v'] ) ) {
146
  $fb_id = $vars['v'];
147
+ $type = 'video';
148
  }
149
+ if ( isset( $vars['set'] ) ) {
150
+ $setArray = explode( '.', $vars['set'] );
151
+ $fb_id = $setArray[1];
152
+ $type = 'album';
153
  }
154
+ $juice = substr( $juice, 0, $pos );
155
  }
156
+ $juiceArray = explode( '/', trim( $juice, '/' ) );
157
+ if ( ! $fb_id ) {
158
+ $fb_id = end( $juiceArray );
159
  }
160
+ if ( in_array( 'posts', $juiceArray ) ) {
161
  $type = 'post';
162
+ if ( $has_fb_app && ( self::is_raw( 'post' ) ) ) {
163
+ try {
164
  /** @noinspection PhpUndefinedVariableInspection */
165
+ $data = $fbsdk->api( '/' . $juiceArray[0] . '?fields=id' );
166
+ $fb_id = $data['id'] . '_' . $fb_id;
167
+ } catch ( FacebookApiException $e ) {
168
+ $res = '<p><a href="' . $original . '" target="_blank" rel="nofollow">' . $original . '</a>';
169
+ if ( is_super_admin() ) {
170
  $error = $e->getResult();
171
+ if ( isset( $error['error']['code'] ) && ( $error['error']['code'] == '803' ) ) {
172
+ $res .= '<br><span style="color: #4a0e13">' . __( 'Error: Try embedding this post as a social plugin (only visible to admins)', 'wp-embed-facebook' ) . '</span>';
173
  } else {
174
+ if ( isset( $error['error']['code'] ) ) {
175
+ $res .= '<br><span style="color: #4a0e13">' . __( 'Code' ) . ':&nbsp;' . $error['error']['code'] . '&nbsp;in type</span>';
176
+ }
177
+ $res .= '<br><span style="color: #4a0e13">' . __( 'Error' ) . ':&nbsp;' . $error['error']['message'] . ' (only visible to admins)</span>';
178
  }
179
  }
180
  $res .= '</p>';
181
+
182
  return $res;
183
  }
184
  }
185
+ } elseif ( in_array( 'photos', $juiceArray ) || in_array( 'photo.php', $juiceArray ) ) {
186
  $type = 'photo';
187
+ } elseif ( in_array( 'events', $juiceArray ) ) {
188
  $type = 'event';
189
+ } elseif ( in_array( 'videos', $juiceArray ) ) {
190
  $type = 'video';
191
  }
192
  /**
197
  * @param string $type the embed type.
198
  * @param array $clean url parts of the request.
199
  */
200
+ $type = apply_filters( 'wpemfb_embed_type', $type, $juiceArray );
201
+ if ( ! $type ) {
202
+ if ( $has_fb_app ) {
203
+ try {
204
  /** @noinspection PhpUndefinedVariableInspection */
205
+ $metadata = $fbsdk->api( '/' . $fb_id . '?metadata=1' );
206
+ $type = $metadata['metadata']['type'];
207
+ } catch ( FacebookApiException $e ) {
208
+ $res = '<p><a href="https://www.facebook.com/' . $juice . '" target="_blank" rel="nofollow">https://www.facebook.com/' . $juice . '</a>';
209
+ if ( is_super_admin() ) {
210
  $error = $e->getResult();
211
+ if ( isset( $error['error']['code'] ) ) {
212
+ $res .= '<br><span style="color: #4a0e13">' . __( 'Code' ) . ':&nbsp;' . $error['error']['code'] . '&nbsp;' . $type . '</span>';
213
+ }
214
+ $res .= '<br><span style="color: #4a0e13">' . __( 'Error' ) . ':&nbsp;' . $error['error']['message'] . ' (only visible to admins)</span>';
215
  }
216
  $res .= '</p>';
217
+
218
  return $res;
219
  }
220
  } else {
221
  $type = 'page';
222
  }
223
  }
224
+ if ( ! is_numeric( $fb_id ) ) {
225
+ $fb_id_array = explode( '-', $fb_id );
226
+ if ( ! empty( $fb_id_array ) && is_int( end( $fb_id_array ) ) ) {
227
+ $fb_id = end( $fb_id_array );
228
  }
229
+ $fb_id = str_replace( ':0', '', $fb_id );
230
  }
231
+ $fb_id = apply_filters( 'wpemfb_embed_fb_id', $fb_id, $juiceArray );
232
+
233
+ return array( 'type' => $type, 'fb_id' => $fb_id );
234
  }
235
+
236
+ static function print_embed( $fb_id, $type, $juice ) {
237
+ if ( ! self::is_raw( $type ) ) {
238
+ $fb_data = array( 'social_plugin' => true, 'link' => $juice, 'type' => $type );
239
  $template_name = 'social-plugin';
240
  } else {
241
+ switch ( $type ) {
242
  case 'page' :
243
+ $fb_data = self::fb_api_get( $fb_id, $juice, $type );
244
+ if ( ! self::valid_fb_data( $fb_data ) ) {
245
  return $fb_data;
246
+ }
247
+ if ( isset( $fb_data['is_community_page'] ) && $fb_data['is_community_page'] == "1" ) {
248
  $template_name = 'com-page';
249
  } else {
250
  $default = 'page';
267
  * @since 1.0
268
  *
269
  * @param string $default file full path
270
+ * @param array $fb_data ['category'] data from facebook
271
  */
272
+ $template_name = apply_filters( 'wpemfb_category_template', $default, $fb_data['category'] );
273
  }
274
  break;
275
  case 'photo' :
277
  case 'video' :
278
  case 'album' :
279
  case 'event' :
280
+ $fb_data = self::fb_api_get( $fb_id, $juice, $type );
281
  $template_name = $type;
282
  break;
283
  case 'user' :
284
+ $fb_data = self::fb_api_get( $fb_id, $juice, 'profile' );
285
  $template_name = 'profile';
286
  break;
287
  default :
288
+ $fb_data = self::fb_api_get( $fb_id, $juice, $type );
289
  $template_name = $type;
290
  break;
291
  }
292
  }
293
 
294
+ if ( ! self::valid_fb_data( $fb_data ) ) {
295
+ return print_r( $fb_data, true );
296
+ }
297
+ $template = self::locate_template( $template_name );
298
  //get default variables to use on templates
299
  /** @noinspection PhpUnusedLocalVariableInspection */
300
+ $width = ! empty( self::$width ) ? self::$width : WP_Embed_FB_Plugin::get_option( 'max_width' );
301
  /** @noinspection PhpUnusedLocalVariableInspection */
 
302
  ob_start();
303
  //show embed post on admin
304
+ if ( is_admin() || (isset($_GET['action']) && $_GET['action'] = 'cs_render_element') ) : ?>
305
+ <script>(function (d, s, id) {
306
+ var js, fjs = d.getElementsByTagName(s)[0];
307
+ if (d.getElementById(id)) return;
308
+ js = d.createElement(s);
309
+ js.id = id;
310
+ js.src = "//connect.facebook.net/<?php echo WP_Embed_FB_Plugin::get_option('sdk_lang'); ?>/sdk.js#xfbml=1&version=<?php echo WP_Embed_FB_Plugin::get_option('sdk_version') ?>";
311
+ fjs.parentNode.insertBefore(js, fjs);
312
+ }(document, 'script', 'facebook-jssdk')); FB.XFBML.parse();</script>
313
  <?php endif;
314
  /**
315
  * Change the file to include on a certain embed.
319
  * @param string $template file full path
320
  * @param array $fb_data data from facebook
321
  */
322
+ $template = apply_filters( 'wpemfb_template', $template, $fb_data, $type );
323
  /** @noinspection PhpIncludeInspection */
324
  include( $template );
325
+
326
+ return preg_replace( '/^\s+|\n|\r|\s+$/m', '', ob_get_clean() );
327
  }
328
+
329
+ static function valid_fb_data( $fb_data ) {
330
+ if ( is_array( $fb_data ) && ( isset( $fb_data['id'] ) || isset( $fb_data['social_plugin'] ) ) ) {
331
  return true;
332
+ }
333
+
334
  return false;
335
  }
336
+
337
  /**
338
  * get data from fb using WP_Embed_FB::$fbsdk->api('/'.$fb_id) :)
339
  *
340
  * @param int $fb_id Facebook id
341
  * @param string $url Facebook url
342
+ *
343
  * @type string type of embed
344
  * @return array|string
345
  */
346
+ static function fb_api_get( $fb_id, $url, $type = "" ) {
347
+ if ( WP_Embed_FB_Plugin::has_fb_app() ) {
348
  $fbsdk = self::get_fbsdk();
349
  try {
350
+ switch ( $type ) {
351
  case 'album' :
352
+ self::$num_photos = is_int( self::$num_photos ) ? self::$num_photos : WP_Embed_FB_Plugin::get_option( 'max_photos' );
353
+ $api_string = $fb_id . '?fields=name,id,from,description,count,photos.fields(name,picture,source,id).limit(' . self::$num_photos . ')';
354
  break;
355
  case 'page' :
356
+ $num_posts = is_int( self::$num_posts ) ? self::$num_posts : WP_Embed_FB_Plugin::get_option( 'max_posts' );
357
+ $api_string = $fb_id . '?fields=name,picture,is_community_page,link,id,cover,category,website,likes,genre';
358
+ if ( intval( $num_posts ) > 0 ) {
359
+ $api_string .= ',posts.limit(' . $num_posts . '){id,full_picture,type,via,source,parent_id,call_to_action,story,place,child_attachments,icon,created_time,message,description,caption,name,shares,link,picture,object_id,likes.limit(1).summary(true),comments.limit(1).summary(true)}';
360
+ }
361
  break;
362
  case 'video' :
363
+ $api_string = $fb_id . '?fields=id,source,picture,from';
364
  break;
365
  case 'photo' :
366
+ $api_string = $fb_id . '?fields=id,source,link,likes.limit(1).summary(true),comments.limit(1).summary(true)';
367
  break;
368
  case 'event' :
369
+ $api_string = $fb_id . '?fields=id,name,start_time,end_time,owner,place,picture,timezone,cover';
370
  break;
371
  case 'post' :
372
+ $api_string = $fb_id . '?fields=from{id,name,likes,link},id,full_picture,type,via,source,parent_id,call_to_action,story,place,child_attachments,icon,created_time,message,description,caption,name,shares,link,picture,object_id,likes.limit(1).summary(true),comments.limit(1).summary(true)';
373
  break;
374
  default :
375
  $api_string = $fb_id;
386
  * @param string $type The detected type of embed
387
  *
388
  */
389
+ $fb_data = $fbsdk->api( WP_Embed_FB_Plugin::get_option( 'sdk_version' ) . '/' . apply_filters( 'wpemfb_api_string', $api_string, $fb_id, $type ) );
390
  $api_string2 = '';
391
 
392
  /**
399
  * @param string $type The detected type of embed
400
  *
401
  */
402
+ $api_string2 = apply_filters( 'wpemfb_2nd_api_string', $api_string2, $fb_data, $type );
403
 
404
+ if ( ! empty( $api_string2 ) ) {
405
+ $extra_data = $fbsdk->api( WP_Embed_FB_Plugin::get_option( 'sdk_version' ) . '/' . $api_string2 );
406
+ $fb_data = array_merge( $fb_data, $extra_data );
407
  }
408
  /**
409
  * Filter all data received from facebook.
413
  * @param array $fb_data the final result
414
  * @param string $type The detected type of embed
415
  */
416
+ $fb_data = apply_filters( 'wpemfb_fb_data', $fb_data, $type );
417
 
418
+ } catch ( FacebookApiException $e ) {
419
+ $fb_data = '<p><a href="https://www.facebook.com/' . $url . '" target="_blank" rel="nofollow">https://www.facebook.com/' . $url . '</a>';
420
+ if ( is_super_admin() ) {
421
  $error = $e->getResult();
422
+ $fb_data .= '<br><small style="color: #4a0e13">' . __( 'Error' ) . ':&nbsp;' . $error['error']['message'] . ' (only visible to admins)</small>';
423
  }
424
  $fb_data .= '</p>';
425
  }
426
  } else {
427
+ $fb_data = '<p><a href="https://www.facebook.com/' . $url . '" target="_blank" rel="nofollow">https://www.facebook.com/' . $url . '</a>';
428
+ if ( is_super_admin() ) {
429
+ $fb_data .= '<br><span style="color: #4a0e13">' . sprintf( __( '<small>To embed this type of content you need to setup a facebook app on <a href="%s" title="WP Embed Facebook Settings">settings</a></small>', 'wp-embed-facebook' ), admin_url( 'options-general.php?page=embedfacebook' ) ) . '</span>';
430
  }
431
  $fb_data .= '</p>';
432
  }
433
 
434
  return $fb_data;
435
  }
436
+
437
  /**
438
  * Locate the template inside plugin or theme
439
  *
440
  * @param string $template_name Template file name
441
+ *
442
  * @return string Template location
443
  */
444
+ static function locate_template( $template_name ) {
445
+ $theme = self::get_theme();
446
+ $located = locate_template( array( 'plugins/wp-embed-facebook/' . $theme . '/' . $template_name . '.php' ) );
447
+ $file = 'templates/' . $theme . '/' . $template_name . '.php';
448
+ if ( empty( $located ) ) {
449
+ $located = WP_Embed_FB_Plugin::get_path() . $file;
450
  }
451
+
452
  return $located;
453
  }
454
+
455
  /**
456
  * If a user has a lot of websites registered on fb this function will only link to the first one
457
+ *
458
  * @param string $urls separated by spaces
459
+ *
460
  * @return string first url
461
  */
462
+ static function getwebsite( $urls ) {
463
+ $url = explode( ' ', trim( $urls ) );
464
+
465
+ return strpos( 'http://', $url[0] ) == false ? 'http://' . $url[0] : $url[0];
466
  }
467
+
468
  /**
469
  * Shortcode function
470
  * [facebook='url' width='600' raw='true' social_plugin='true' posts='2' ] width is optional
471
+ *
472
  * @param array $atts [0]=>url ['width']=>embed width ['raw']=>for videos and photos
473
+ *
474
  * @return string
475
  */
476
+ static function shortcode( $atts ) {
477
+ if ( ! empty( $atts ) && isset( $atts[0] ) ) {
478
+ $clean = trim( $atts[0], '=' );
479
+ if ( is_int( $clean ) ) {
480
  $juice = $clean;
481
  $clean = "https://www.facebook.com/$juice";
482
  } else {
483
+ if ( strpos( $clean, 'facebook.com' ) === false ) {
484
+ return "<p>" . __( "This is not a valid facebook url", "wp-embed-facebook" ) . " $clean </p>";
485
+ }
486
+ $juice = str_replace( array(
487
+ 'https:',
488
+ 'http:',
489
+ '//facebook.com/',
490
+ '//m.facebook.com/',
491
+ '//facebook.com/',
492
+ '//www.facebook.com/'
493
+ ), '', $clean );
494
  }
495
+ $embed = self::fb_embed( array( 'https', '://www.facebook.com/', $juice ), $clean, $atts );
496
+
497
  return $embed;
498
  }
499
+
500
  return '';
501
  }
502
+
503
+ static function embed_register_handler(
504
+ $match, /** @noinspection PhpUnusedParameterInspection */
505
+ $attr = null, $url = null, $atts = null
506
+ ) {
507
+ return self::fb_embed( $match, $url, $atts );
508
  }
509
+
510
+ static function make_clickable( $text ) {
511
+ return wpautop( self::rel_nofollow( make_clickable( $text ) ) );
512
  }
513
+
514
  static function rel_nofollow( $text ) {
515
+ $text = stripslashes( $text );
516
+
517
+ return preg_replace_callback( '|<a (.+?)>|i', array( __CLASS__, 'nofollow_callback' ), $text );
518
  }
519
+
520
  static function nofollow_callback( $matches ) {
521
  $text = $matches[1];
522
+ $text = str_replace( array( ' rel="nofollow"', " rel='nofollow'" ), '', $text );
523
+
524
  return "<a $text rel=\"nofollow\">";
525
  }
526
+
527
+ static function set_atts( $atts ) {
528
+ if(WP_Embed_FB_Plugin::has_photon())
529
+ add_filter('jetpack_photon_skip_image','__return_false');
530
+ if ( isset( $atts['width'] ) ) {
531
  self::$width = $atts['width'];
532
  }
533
+ if ( isset( $atts['raw'] ) ) {
534
+ if ( $atts['raw'] == 'true' ) {
535
  self::$raw = true;
536
+ } else {
537
  self::$raw = false;
538
  }
539
  }
540
+ if ( isset( $atts['social_plugin'] ) ) {
541
+ if ( $atts['social_plugin'] == 'true' ) {
542
  self::$raw = false;
543
+ } else {
544
  self::$raw = true;
545
  }
546
  }
547
+ if ( isset( $atts['theme'] ) ) {
 
548
  self::$theme = $atts['theme'];
549
  }
550
+ if ( isset( $atts['posts'] ) ) {
551
+ self::$num_posts = intval( $atts['posts'] );
552
  }
553
+ if ( isset( $atts['photos'] ) ) {
554
+ self::$num_photos = intval( $atts['photos'] );
555
  }
556
  }
557
+
558
+ static function clear_atts() {
559
  self::$width = self::$raw = self::$num_posts = self::$theme = self::$num_photos = null;
560
+ if(WP_Embed_FB_Plugin::has_photon())
561
+ add_filter('jetpack_photon_skip_image','__return_true');
562
  }
 
 
 
 
563
 
564
+ static function fb_root( $content ) {
565
+ return '<div id="fb-root"></div>' . PHP_EOL . $content;
566
+ }
567
+ }
lib/js/fb.js CHANGED
@@ -1,11 +1,11 @@
1
- jQuery(document).ready(function() {
2
- jQuery.ajaxSetup({ cache: true });
3
- var script_name = '//connect.facebook.net/' + WEF.local + '/sdk.js';
4
- jQuery.getScript(script_name, function(){
5
  FB.init({
6
- appId: WEF.fb_id,
7
  version: WEF.version,
8
- xfbml: true
9
  });
10
  });
11
  });
1
+ jQuery(document).ready(function () {
2
+ jQuery.ajaxSetup({cache: true});
3
+ var script_name = '//connect.facebook.net/' + WEF.local + '/sdk.js';
4
+ jQuery.getScript(script_name, function () {
5
  FB.init({
6
+ appId: WEF.fb_id,
7
  version: WEF.version,
8
+ xfbml: true
9
  });
10
  });
11
  });
lib/js/fb.min.js ADDED
@@ -0,0 +1 @@
 
1
+ jQuery(document).ready(function(){jQuery.ajaxSetup({cache:true});var script_name="//connect.facebook.net/"+WEF.local+"/sdk.js";jQuery.getScript(script_name,function(){FB.init({appId:WEF.fb_id,version:WEF.version,xfbml:true})})});
lib/js/wpembedfb.js CHANGED
@@ -1,13 +1,4 @@
1
  jQuery(document).ready(function() {
2
- resize_cover();
3
  var v_width = jQuery(".wef-measure").outerWidth();
4
  jQuery(".fb-post").attr("data-width",v_width+"px");
5
- });
6
- jQuery(window).resize(function(){
7
- resize_cover();
8
- });
9
- function resize_cover(){
10
- jQuery(".wef-measure > .cover").each(function(){
11
- jQuery(this).css("height",0.368 * jQuery(this).width());
12
- });
13
- }
1
  jQuery(document).ready(function() {
 
2
  var v_width = jQuery(".wef-measure").outerWidth();
3
  jQuery(".fb-post").attr("data-width",v_width+"px");
4
+ });
 
 
 
 
 
 
 
 
lib/js/wpembedfb.min.js ADDED
@@ -0,0 +1 @@
 
1
+ jQuery(document).ready(function(){var v_width=jQuery(".wef-measure").outerWidth();jQuery(".fb-post").attr("data-width",v_width+"px")});
lib/lightbox2/css/lightbox.css ADDED
@@ -0,0 +1 @@
 
1
+ body:after{content:url("../images/close.png") url("../images/loading.gif") url("../images/prev.png") url("../images/next.png");display:none}body .lb-disable-scrolling{overflow:hidden}.lightboxOverlay{position:absolute;top:0;left:0;z-index:999999;background-color:#000;filter:progid:DXImageTransform.Microsoft.Alpha(Opacity=80);opacity:0.8;display:none}.lightbox{position:absolute;left:0;width:100%;z-index:1000000;text-align:center;line-height:0;font-weight:normal}.lightbox .lb-image{display:block;height:auto;max-width:inherit;border-radius:3px}.lightbox a img{border:none}.lb-outerContainer{position:relative;background-color:#fff;*zoom:1;width:250px;height:250px;margin:0 auto;border-radius:4px}.lb-outerContainer:after{content:"";display:table;clear:both}.lb-container{padding:4px}.lb-container>.nav{left:0}.lb-loader{position:absolute;top:43%;left:0;height:25%;width:100%;text-align:center;line-height:0}.lb-cancel{display:block;width:32px;height:32px;margin:0 auto;background:url("../images/loading.gif") no-repeat}.lb-prev,.lb-next{height:100%;cursor:pointer;display:block}.lb-nav{position:absolute;top:0;left:0;height:100%;width:100%;z-index:10}.lb-nav a{outline:none;background-image:url("data:image/gifbase64,R0lGODlhAQABAPAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==")}.lb-nav a.lb-prev{width:34%;left:0;float:left;background:url("../images/prev.png") left 48% no-repeat;filter:progid:DXImageTransform.Microsoft.Alpha(Opacity=0);opacity:0;-webkit-transition:opacity 0.6s;-moz-transition:opacity 0.6s;-o-transition:opacity 0.6s;transition:opacity 0.6s}.lb-nav a.lb-prev:hover{filter:progid:DXImageTransform.Microsoft.Alpha(Opacity=100);opacity:1}.lb-nav a.lb-next{width:64%;right:0;float:right;background:url(../images/next.png) right 48% no-repeat;filter:progid:DXImageTransform.Microsoft.Alpha(Opacity=0);opacity:0;-webkit-transition:opacity 0.6s;-moz-transition:opacity 0.6s;-o-transition:opacity 0.6s;transition:opacity 0.6s}.lb-nav a.lb-next:hover{filter:progid:DXImageTransform.Microsoft.Alpha(Opacity=100);opacity:1}.lb-dataContainer{margin:0 auto;padding-top:5px;*zoom:1;width:100%;-moz-border-radius-bottomleft:4px;-webkit-border-bottom-left-radius:4px;border-bottom-left-radius:4px;-moz-border-radius-bottomright:4px;-webkit-border-bottom-right-radius:4px;border-bottom-right-radius:4px}.lb-dataContainer:after{content:"";display:table;clear:both}.lb-data{padding:0 4px;color:#ccc}.lb-data .lb-details{width:85%;float:left;text-align:left;line-height:1.1em}.lb-data .lb-caption{font-size:13px;font-weight:bold;line-height:1em}.lb-data .lb-number{display:block;clear:left;padding-bottom:1em;font-size:12px;color:#999}.lb-data .lb-close{display:block;float:right;width:30px;height:30px;background:url(../images/close.png) top right no-repeat;text-align:right;outline:none;filter:progid:DXImageTransform.Microsoft.Alpha(Opacity=70);opacity:0.7;-webkit-transition:opacity 0.2s;-moz-transition:opacity 0.2s;-o-transition:opacity 0.2s;transition:opacity 0.2s}.lb-data .lb-close:hover{cursor:pointer;filter:progid:DXImageTransform.Microsoft.Alpha(Opacity=100);opacity:1}
lib/lightbox2/css/lightbox.min.css DELETED
@@ -1 +0,0 @@
1
- .lb-loader,.lightbox{text-align:center;line-height:0}body:after{content:url(../images/close.png) url(../images/loading.gif) url(../images/prev.png) url(../images/next.png);display:none}.lb-dataContainer:after,.lb-outerContainer:after{content:"";clear:both}body.lb-disable-scrolling{overflow:hidden}.lightboxOverlay{position:absolute;top:0;left:0;z-index:999999;background-color:#000;filter:alpha(Opacity=80);opacity:.8;display:none}.lightbox{position:absolute;left:0;width:100%;z-index:1000000;font-weight:400}.lightbox .lb-image{display:block;height:auto;max-width:inherit;border-radius:3px}.lightbox a img{border:none}.lb-outerContainer{position:relative;background-color:#fff;width:250px;height:250px;margin:0 auto;border-radius:4px}.lb-loader,.lb-nav{position:absolute;left:0}.lb-outerContainer:after{display:table}.lb-container{padding:4px}.lb-loader{top:43%;height:25%;width:100%}.lb-cancel{display:block;width:32px;height:32px;margin:0 auto;background:url(../images/loading.gif) no-repeat}.lb-nav{top:0;height:100%;width:100%;z-index:10}.lb-container>.nav{left:0}.lb-nav a{outline:0;background-image:url(data:image/gif;base64,R0lGODlhAQABAPAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==)}.lb-next,.lb-prev{height:100%;cursor:pointer;display:block}.lb-nav a.lb-prev{width:34%;left:0;float:left;background:url(../images/prev.png) left 48% no-repeat;filter:alpha(Opacity=0);opacity:0;-webkit-transition:opacity .6s;-moz-transition:opacity .6s;-o-transition:opacity .6s;transition:opacity .6s}.lb-nav a.lb-prev:hover{filter:alpha(Opacity=100);opacity:1}.lb-nav a.lb-next{width:64%;right:0;float:right;background:url(../images/next.png) right 48% no-repeat;filter:alpha(Opacity=0);opacity:0;-webkit-transition:opacity .6s;-moz-transition:opacity .6s;-o-transition:opacity .6s;transition:opacity .6s}.lb-nav a.lb-next:hover{filter:alpha(Opacity=100);opacity:1}.lb-dataContainer{margin:0 auto;padding-top:5px;width:100%;-moz-border-radius-bottomleft:4px;-webkit-border-bottom-left-radius:4px;border-bottom-left-radius:4px;-moz-border-radius-bottomright:4px;-webkit-border-bottom-right-radius:4px;border-bottom-right-radius:4px}.lb-dataContainer:after{display:table}.lb-data{padding:0 4px;color:#ccc}.lb-data .lb-details{width:85%;float:left;text-align:left;line-height:1.1em}.lb-data .lb-caption{font-size:13px;font-weight:700;line-height:1em}.lb-data .lb-number{display:block;clear:left;padding-bottom:1em;font-size:12px;color:#999}.lb-data .lb-close{display:block;float:right;width:30px;height:30px;background:url(../images/close.png) top right no-repeat;text-align:right;outline:0;filter:alpha(Opacity=70);opacity:.7;-webkit-transition:opacity .2s;-moz-transition:opacity .2s;-o-transition:opacity .2s;transition:opacity .2s}.lb-data .lb-close:hover{cursor:pointer;filter:alpha(Opacity=100);opacity:1}
 
lib/lightbox2/css/lightbox.sass ADDED
@@ -0,0 +1,168 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ body
2
+ &:after
3
+ content: url('../images/close.png') url('../images/loading.gif') url('../images/prev.png') url('../images/next.png')
4
+ display: none
5
+ .lb-disable-scrolling
6
+ overflow: hidden
7
+
8
+ .lightboxOverlay
9
+ position: absolute
10
+ top: 0
11
+ left: 0
12
+ z-index: 999999
13
+ background-color: black
14
+ filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=80)
15
+ opacity: 0.8
16
+ display: none
17
+
18
+ .lightbox
19
+ position: absolute
20
+ left: 0
21
+ width: 100%
22
+ z-index: 1000000
23
+ text-align: center
24
+ line-height: 0
25
+ font-weight: normal
26
+ .lb-image
27
+ display: block
28
+ height: auto
29
+ max-width: inherit
30
+ border-radius: 3px
31
+ a img
32
+ border: none
33
+
34
+ .lb-outerContainer
35
+ position: relative
36
+ background-color: white
37
+ *zoom: 1
38
+ width: 250px
39
+ height: 250px
40
+ margin: 0 auto
41
+ border-radius: 4px
42
+ &:after
43
+ content: ""
44
+ display: table
45
+ clear: both
46
+
47
+
48
+ .lb-container
49
+ padding: 4px
50
+ > .nav
51
+ left: 0
52
+
53
+ .lb-loader
54
+ position: absolute
55
+ top: 43%
56
+ left: 0
57
+ height: 25%
58
+ width: 100%
59
+ text-align: center
60
+ line-height: 0
61
+
62
+
63
+ .lb-cancel
64
+ display: block
65
+ width: 32px
66
+ height: 32px
67
+ margin: 0 auto
68
+ background: url('../images/loading.gif') no-repeat
69
+
70
+
71
+ .lb-prev, .lb-next
72
+ height: 100%
73
+ cursor: pointer
74
+ display: block
75
+
76
+ .lb-nav
77
+ position: absolute
78
+ top: 0
79
+ left: 0
80
+ height: 100%
81
+ width: 100%
82
+ z-index: 10
83
+ a
84
+ outline: none
85
+ background-image: url('data:image/gifbase64,R0lGODlhAQABAPAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==')
86
+ a.lb-prev
87
+ width: 34%
88
+ left: 0
89
+ float: left
90
+ background: url('../images/prev.png') left 48% no-repeat
91
+ filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=0)
92
+ opacity: 0
93
+ -webkit-transition: opacity 0.6s
94
+ -moz-transition: opacity 0.6s
95
+ -o-transition: opacity 0.6s
96
+ transition: opacity 0.6s
97
+ &:hover
98
+ filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=100)
99
+ opacity: 1
100
+ a.lb-next
101
+ width: 64%
102
+ right: 0
103
+ float: right
104
+ background: url(../images/next.png) right 48% no-repeat
105
+ filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=0)
106
+ opacity: 0
107
+ -webkit-transition: opacity 0.6s
108
+ -moz-transition: opacity 0.6s
109
+ -o-transition: opacity 0.6s
110
+ transition: opacity 0.6s
111
+ &:hover
112
+ filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=100)
113
+ opacity: 1
114
+
115
+
116
+ .lb-dataContainer
117
+ margin: 0 auto
118
+ padding-top: 5px
119
+ *zoom: 1
120
+ width: 100%
121
+ -moz-border-radius-bottomleft: 4px
122
+ -webkit-border-bottom-left-radius: 4px
123
+ border-bottom-left-radius: 4px
124
+ -moz-border-radius-bottomright: 4px
125
+ -webkit-border-bottom-right-radius: 4px
126
+ border-bottom-right-radius: 4px
127
+ &:after
128
+ content: ""
129
+ display: table
130
+ clear: both
131
+
132
+ .lb-data
133
+ padding: 0 4px
134
+ color: #ccc
135
+ .lb-details
136
+ width: 85%
137
+ float: left
138
+ text-align: left
139
+ line-height: 1.1em
140
+ .lb-caption
141
+ font-size: 13px
142
+ font-weight: bold
143
+ line-height: 1em
144
+ .lb-number
145
+ display: block
146
+ clear: left
147
+ padding-bottom: 1em
148
+ font-size: 12px
149
+ color: #999999
150
+ .lb-close
151
+ display: block
152
+ float: right
153
+ width: 30px
154
+ height: 30px
155
+ background: url(../images/close.png) top right no-repeat
156
+ text-align: right
157
+ outline: none
158
+ filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=70)
159
+ opacity: 0.7
160
+ -webkit-transition: opacity 0.2s
161
+ -moz-transition: opacity 0.2s
162
+ -o-transition: opacity 0.2s
163
+ transition: opacity 0.2s
164
+ &:hover
165
+ cursor: pointer
166
+ filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=100)
167
+ opacity: 1
168
+
lib/lightbox2/images/close.png CHANGED
File without changes
lib/lightbox2/images/loading.gif CHANGED
File without changes
lib/lightbox2/images/next.png CHANGED
File without changes
lib/lightbox2/images/prev.png CHANGED
File without changes
lib/lightbox2/js/lightbox.js ADDED
@@ -0,0 +1,453 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*!
2
+ * Lightbox v2.8.2
3
+ * by Lokesh Dhakar
4
+ * Adaptation for WordPress by Miguel Sirvent
5
+ *
6
+ * More info:
7
+ * http://lokeshdhakar.com/projects/lightbox2/
8
+ * http://wpembedfb.com
9
+ *
10
+ * Copyright 2007, 2015 Lokesh Dhakar
11
+ * Released under the MIT license
12
+ * https://github.com/lokesh/lightbox2/blob/master/LICENSE
13
+ */
14
+
15
+ jQuery(function( $ ) {
16
+ // Descriptions of all options available on the demo site:
17
+ // http://lokeshdhakar.com/projects/lightbox2/index.html#options
18
+
19
+ function Lightbox(options) {
20
+ this.album = [];
21
+ this.currentImageIndex = void 0;
22
+ this.init();
23
+
24
+ // options
25
+ this.options = $.extend({}, this.constructor.defaults);
26
+ this.option(options);
27
+ }
28
+ Lightbox.defaults = {
29
+ albumLabel: 'Image %1 of %2',
30
+ alwaysShowNavOnTouchDevices: false,
31
+ fadeDuration: 500,
32
+ fitImagesInViewport: true,
33
+ // maxWidth: 800,
34
+ // maxHeight: 600,
35
+ positionFromTop: 50,
36
+ resizeDuration: 700,
37
+ showImageNumberLabel: true,
38
+ wrapAround: false,
39
+ disableScrolling: false
40
+ };
41
+
42
+ Lightbox.prototype.option = function(options) {
43
+ $.extend(this.options, options);
44
+ };
45
+
46
+ Lightbox.prototype.imageCountLabel = function(currentImageNum, totalImages) {
47
+ return this.options.albumLabel.replace(/%1/g, currentImageNum).replace(/%2/g, totalImages);
48
+ };
49
+
50
+ Lightbox.prototype.init = function() {
51
+ this.enable();
52
+ this.build();
53
+ };
54
+
55
+ // Loop through anchors and areamaps looking for either data-lightbox attributes or rel attributes
56
+ // that contain 'lightbox'. When these are clicked, start lightbox.
57
+ Lightbox.prototype.enable = function() {
58
+ var self = this;
59
+ $('body').on('click', 'a[rel^=lightbox], area[rel^=lightbox], a[data-lightbox], area[data-lightbox]', function(event) {
60
+ self.start($(event.currentTarget));
61
+ return false;
62
+ });
63
+ };
64
+
65
+ // Build html for the lightbox and the overlay.
66
+ // Attach event handlers to the new DOM elements. click click click
67
+ Lightbox.prototype.build = function() {
68
+ var self = this;
69
+ $('<div id="lightboxOverlay" class="lightboxOverlay"></div><div id="lightbox" class="lightbox"><div class="lb-outerContainer"><div class="lb-container"><img class="lb-image" src="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==" /><div class="lb-nav"><a class="lb-prev" href="" ></a><a class="lb-next" href="" ></a></div><div class="lb-loader"><a class="lb-cancel"></a></div></div></div><div class="lb-dataContainer"><div class="lb-data"><div class="lb-details"><span class="lb-caption"></span><span class="lb-number"></span></div><div class="lb-closeContainer"><a class="lb-close"></a></div></div></div></div>').appendTo($('body'));
70
+
71
+ // Cache jQuery objects
72
+ this.$lightbox = $('#lightbox');
73
+ this.$overlay = $('#lightboxOverlay');
74
+ this.$outerContainer = this.$lightbox.find('.lb-outerContainer');
75
+ this.$container = this.$lightbox.find('.lb-container');
76
+
77
+ // Store css values for future lookup
78
+ this.containerTopPadding = parseInt(this.$container.css('padding-top'), 10);
79
+ this.containerRightPadding = parseInt(this.$container.css('padding-right'), 10);
80
+ this.containerBottomPadding = parseInt(this.$container.css('padding-bottom'), 10);
81
+ this.containerLeftPadding = parseInt(this.$container.css('padding-left'), 10);
82
+
83
+ // Attach event handlers to the newly minted DOM elements
84
+ this.$overlay.hide().on('click', function() {
85
+ self.end();
86
+ return false;
87
+ });
88
+
89
+ this.$lightbox.hide().on('click', function(event) {
90
+ if ($(event.target).attr('id') === 'lightbox') {
91
+ self.end();
92
+ }
93
+ return false;
94
+ });
95
+
96
+ this.$outerContainer.on('click', function(event) {
97
+ if ($(event.target).attr('id') === 'lightbox') {
98
+ self.end();
99
+ }
100
+ return false;
101
+ });
102
+
103
+ this.$lightbox.find('.lb-prev').on('click', function() {
104
+ if (self.currentImageIndex === 0) {
105
+ self.changeImage(self.album.length - 1);
106
+ } else {
107
+ self.changeImage(self.currentImageIndex - 1);
108
+ }
109
+ return false;
110
+ });
111
+
112
+ this.$lightbox.find('.lb-next').on('click', function() {
113
+ if (self.currentImageIndex === self.album.length - 1) {
114
+ self.changeImage(0);
115
+ } else {
116
+ self.changeImage(self.currentImageIndex + 1);
117
+ }
118
+ return false;
119
+ });
120
+
121
+ this.$lightbox.find('.lb-loader, .lb-close').on('click', function() {
122
+ self.end();
123
+ return false;
124
+ });
125
+ };
126
+
127
+ // Show overlay and lightbox. If the image is part of a set, add siblings to album array.
128
+ Lightbox.prototype.start = function($link) {
129
+ var self = this;
130
+ var $window = $(window);
131
+
132
+ $window.on('resize', $.proxy(this.sizeOverlay, this));
133
+
134
+ $('select, object, embed').css({
135
+ visibility: 'hidden'
136
+ });
137
+
138
+ this.sizeOverlay();
139
+
140
+ this.album = [];
141
+ var imageNumber = 0;
142
+
143
+ function addToAlbum($link) {
144
+ self.album.push({
145
+ link: $link.attr('href'),
146
+ title: $link.attr('data-title') || $link.attr('title')
147
+ });
148
+ }
149
+
150
+ // Support both data-lightbox attribute and rel attribute implementations
151
+ var dataLightboxValue = $link.attr('data-lightbox');
152
+ var $links;
153
+
154
+ if (dataLightboxValue) {
155
+ $links = $($link.prop('tagName') + '[data-lightbox="' + dataLightboxValue + '"]');
156
+ for (var i = 0; i < $links.length; i = ++i) {
157
+ addToAlbum($($links[i]));
158
+ if ($links[i] === $link[0]) {
159
+ imageNumber = i;
160
+ }
161
+ }
162
+ } else {
163
+ if ($link.attr('rel') === 'lightbox') {
164
+ // If image is not part of a set
165
+ addToAlbum($link);
166
+ } else {
167
+ // If image is part of a set
168
+ $links = $($link.prop('tagName') + '[rel="' + $link.attr('rel') + '"]');
169
+ for (var j = 0; j < $links.length; j = ++j) {
170
+ addToAlbum($($links[j]));
171
+ if ($links[j] === $link[0]) {
172
+ imageNumber = j;
173
+ }
174
+ }
175
+ }
176
+ }
177
+
178
+ // Position Lightbox
179
+ var top = $window.scrollTop() + this.options.positionFromTop;
180
+ var left = $window.scrollLeft();
181
+ this.$lightbox.css({
182
+ top: top + 'px',
183
+ left: left + 'px'
184
+ }).fadeIn(this.options.fadeDuration);
185
+
186
+ // Disable scrolling of the page while open
187
+ if (this.options.disableScrolling) {
188
+ $('body').addClass('lb-disable-scrolling');
189
+ }
190
+
191
+ this.changeImage(imageNumber);
192
+ };
193
+
194
+ // Hide most UI elements in preparation for the animated resizing of the lightbox.
195
+ Lightbox.prototype.changeImage = function(imageNumber) {
196
+ var self = this;
197
+
198
+ this.disableKeyboardNav();
199
+ var $image = this.$lightbox.find('.lb-image');
200
+
201
+ this.$overlay.fadeIn(this.options.fadeDuration);
202
+
203
+ $('.lb-loader').fadeIn('slow');
204
+ this.$lightbox.find('.lb-image, .lb-nav, .lb-prev, .lb-next, .lb-dataContainer, .lb-numbers, .lb-caption').hide();
205
+
206
+ this.$outerContainer.addClass('animating');
207
+
208
+ // When image to show is preloaded, we send the width and height to sizeContainer()
209
+ var preloader = new Image();
210
+ preloader.onload = function() {
211
+ var $preloader;
212
+ var imageHeight;
213
+ var imageWidth;
214
+ var maxImageHeight;
215
+ var maxImageWidth;
216
+ var windowHeight;
217
+ var windowWidth;
218
+
219
+ $image.attr('src', self.album[imageNumber].link);
220
+
221
+ $preloader = $(preloader);
222
+
223
+ $image.width(preloader.width);
224
+ $image.height(preloader.height);
225
+
226
+ if (self.options.fitImagesInViewport) {
227
+ // Fit image inside the viewport.
228
+ // Take into account the border around the image and an additional 10px gutter on each side.
229
+
230
+ windowWidth = $(window).width();
231
+ windowHeight = $(window).height();
232
+ maxImageWidth = windowWidth - self.containerLeftPadding - self.containerRightPadding - 20;
233
+ maxImageHeight = windowHeight - self.containerTopPadding - self.containerBottomPadding - 120;
234
+
235
+ // Check if image size is larger then maxWidth|maxHeight in settings
236
+ if (self.options.maxWidth && self.options.maxWidth < maxImageWidth) {
237
+ maxImageWidth = self.options.maxWidth;
238
+ }
239
+ if (self.options.maxHeight && self.options.maxHeight < maxImageWidth) {
240
+ maxImageHeight = self.options.maxHeight;
241
+ }
242
+
243
+ // Is there a fitting issue?
244
+ if ((preloader.width > maxImageWidth) || (preloader.height > maxImageHeight)) {
245
+ if ((preloader.width / maxImageWidth) > (preloader.height / maxImageHeight)) {
246
+ imageWidth = maxImageWidth;
247
+ imageHeight = parseInt(preloader.height / (preloader.width / imageWidth), 10);
248
+ $image.width(imageWidth);
249
+ $image.height(imageHeight);
250
+ } else {
251
+ imageHeight = maxImageHeight;
252
+ imageWidth = parseInt(preloader.width / (preloader.height / imageHeight), 10);
253
+ $image.width(imageWidth);
254
+ $image.height(imageHeight);
255
+ }
256
+ }
257
+ }
258
+ self.sizeContainer($image.width(), $image.height());
259
+ };
260
+
261
+ preloader.src = this.album[imageNumber].link;
262
+ this.currentImageIndex = imageNumber;
263
+ };
264
+
265
+ // Stretch overlay to fit the viewport
266
+ Lightbox.prototype.sizeOverlay = function() {
267
+ this.$overlay
268
+ .width($(document).width())
269
+ .height($(document).height());
270
+ };
271
+
272
+ // Animate the size of the lightbox to fit the image we are showing
273
+ Lightbox.prototype.sizeContainer = function(imageWidth, imageHeight) {
274
+ var self = this;
275
+
276
+ var oldWidth = this.$outerContainer.outerWidth();
277
+ var oldHeight = this.$outerContainer.outerHeight();
278
+ var newWidth = imageWidth + this.containerLeftPadding + this.containerRightPadding;
279
+ var newHeight = imageHeight + this.containerTopPadding + this.containerBottomPadding;
280
+
281
+ function postResize() {
282
+ self.$lightbox.find('.lb-dataContainer').width(newWidth);
283
+ self.$lightbox.find('.lb-prevLink').height(newHeight);
284
+ self.$lightbox.find('.lb-nextLink').height(newHeight);
285
+ self.showImage();
286
+ }
287
+
288
+ if (oldWidth !== newWidth || oldHeight !== newHeight) {
289
+ this.$outerContainer.animate({
290
+ width: newWidth,
291
+ height: newHeight
292
+ }, this.options.resizeDuration, 'swing', function() {
293
+ postResize();
294
+ });
295
+ } else {
296
+ postResize();
297
+ }
298
+ };
299
+
300
+ // Display the image and its details and begin preload neighboring images.
301
+ Lightbox.prototype.showImage = function() {
302
+ this.$lightbox.find('.lb-loader').stop(true).hide();
303
+ this.$lightbox.find('.lb-image').fadeIn('slow');
304
+
305
+ this.updateNav();
306
+ this.updateDetails();
307
+ this.preloadNeighboringImages();
308
+ this.enableKeyboardNav();
309
+ };
310
+
311
+ // Display previous and next navigation if appropriate.
312
+ Lightbox.prototype.updateNav = function() {
313
+ // Check to see if the browser supports touch events. If so, we take the conservative approach
314
+ // and assume that mouse hover events are not supported and always show prev/next navigation
315
+ // arrows in image sets.
316
+ var alwaysShowNav = false;
317
+ try {
318
+ document.createEvent('TouchEvent');
319
+ alwaysShowNav = (this.options.alwaysShowNavOnTouchDevices) ? true : false;
320
+ } catch (e) {}
321
+
322
+ this.$lightbox.find('.lb-nav').show();
323
+
324
+ if (this.album.length > 1) {
325
+ if (this.options.wrapAround) {
326
+ if (alwaysShowNav) {
327
+ this.$lightbox.find('.lb-prev, .lb-next').css('opacity', '1');
328
+ }
329
+ this.$lightbox.find('.lb-prev, .lb-next').show();
330
+ } else {
331
+ if (this.currentImageIndex > 0) {
332
+ this.$lightbox.find('.lb-prev').show();
333
+ if (alwaysShowNav) {
334
+ this.$lightbox.find('.lb-prev').css('opacity', '1');
335
+ }
336
+ }
337
+ if (this.currentImageIndex < this.album.length - 1) {
338
+ this.$lightbox.find('.lb-next').show();
339
+ if (alwaysShowNav) {
340
+ this.$lightbox.find('.lb-next').css('opacity', '1');
341
+ }
342
+ }
343
+ }
344
+ }
345
+ };
346
+
347
+ // Display caption, image number, and closing button.
348
+ Lightbox.prototype.updateDetails = function() {
349
+ var self = this;
350
+
351
+ // Enable anchor clicks in the injected caption html.
352
+ // Thanks Nate Wright for the fix. @https://github.com/NateWr
353
+ if (typeof this.album[this.currentImageIndex].title !== 'undefined' &&
354
+ this.album[this.currentImageIndex].title !== '') {
355
+ this.$lightbox.find('.lb-caption')
356
+ .html(this.album[this.currentImageIndex].title)
357
+ .fadeIn('fast')
358
+ .find('a').on('click', function(event) {
359
+ if ($(this).attr('target') !== undefined) {
360
+ window.open($(this).attr('href'), $(this).attr('target'));
361
+ } else {
362
+ location.href = $(this).attr('href');
363
+ }
364
+ });
365
+ }
366
+
367
+ if (this.album.length > 1 && this.options.showImageNumberLabel) {
368
+ var labelText = this.imageCountLabel(this.currentImageIndex + 1, this.album.length);
369
+ this.$lightbox.find('.lb-number').text(labelText).fadeIn('fast');
370
+ } else {
371
+ this.$lightbox.find('.lb-number').hide();
372
+ }
373
+
374
+ this.$outerContainer.removeClass('animating');
375
+
376
+ this.$lightbox.find('.lb-dataContainer').fadeIn(this.options.resizeDuration, function() {
377
+ return self.sizeOverlay();
378
+ });
379
+ };
380
+
381
+ // Preload previous and next images in set.
382
+ Lightbox.prototype.preloadNeighboringImages = function() {
383
+ if (this.album.length > this.currentImageIndex + 1) {
384
+ var preloadNext = new Image();
385
+ preloadNext.src = this.album[this.currentImageIndex + 1].link;
386
+ }
387
+ if (this.currentImageIndex > 0) {
388
+ var preloadPrev = new Image();
389
+ preloadPrev.src = this.album[this.currentImageIndex - 1].link;
390
+ }
391
+ };
392
+
393
+ Lightbox.prototype.enableKeyboardNav = function() {
394
+ $(document).on('keyup.keyboard', $.proxy(this.keyboardAction, this));
395
+ };
396
+
397
+ Lightbox.prototype.disableKeyboardNav = function() {
398
+ $(document).off('.keyboard');
399
+ };
400
+
401
+ Lightbox.prototype.keyboardAction = function(event) {
402
+ var KEYCODE_ESC = 27;
403
+ var KEYCODE_LEFTARROW = 37;
404
+ var KEYCODE_RIGHTARROW = 39;
405
+
406
+ var keycode = event.keyCode;
407
+ var key = String.fromCharCode(keycode).toLowerCase();
408
+ if (keycode === KEYCODE_ESC || key.match(/x|o|c/)) {
409
+ this.end();
410
+ } else if (key === 'p' || keycode === KEYCODE_LEFTARROW) {
411
+ if (this.currentImageIndex !== 0) {
412
+ this.changeImage(this.currentImageIndex - 1);
413
+ } else if (this.options.wrapAround && this.album.length > 1) {
414
+ this.changeImage(this.album.length - 1);
415
+ }
416
+ } else if (key === 'n' || keycode === KEYCODE_RIGHTARROW) {
417
+ if (this.currentImageIndex !== this.album.length - 1) {
418
+ this.changeImage(this.currentImageIndex + 1);
419
+ } else if (this.options.wrapAround && this.album.length > 1) {
420
+ this.changeImage(0);
421
+ }
422
+ }
423
+ };
424
+ // Closing time. :-(
425
+ Lightbox.prototype.end = function() {
426
+ this.disableKeyboardNav();
427
+ $(window).off('resize', this.sizeOverlay);
428
+ this.$lightbox.fadeOut(this.options.fadeDuration);
429
+ this.$overlay.fadeOut(this.options.fadeDuration);
430
+ $('select, object, embed').css({
431
+ visibility: 'visible'
432
+ });
433
+ if (this.options.disableScrolling) {
434
+ $('body').removeClass('lb-disable-scrolling');
435
+ }
436
+ };
437
+ if (typeof WEF_LB === "undefined") {
438
+ new Lightbox();
439
+ } else {
440
+ for (var key in WEF_LB) {
441
+ if (WEF_LB.hasOwnProperty(key)) {
442
+ if(WEF_LB[key]=='false'){
443
+ WEF_LB[key] = false;
444
+ }
445
+ if(WEF_LB[key]=='true'){
446
+ WEF_LB[key] = true;
447
+ }
448
+ }
449
+ }
450
+ new Lightbox(WEF_LB);
451
+ }
452
+ });
453
+
lib/lightbox2/js/lightbox.min.js CHANGED
@@ -1,129 +1 @@
1
- /**
2
- * Lightbox v2.7.1
3
- * by Lokesh Dhakar - http://lokeshdhakar.com/projects/lightbox2/
4
- *
5
- * @license http://creativecommons.org/licenses/by/2.5/
6
- * - Free for use in both personal and commercial projects
7
- * - Attribution requires leaving author name, author link, and the license info intact
8
- */
9
- (function () {
10
- var a = jQuery, b = function () {
11
- function a() {
12
- this.fadeDuration = 500, this.fitImagesInViewport = !0, this.resizeDuration = 700, this.positionFromTop = 50, this.showImageNumberLabel = !0, this.alwaysShowNavOnTouchDevices = !1, this.wrapAround = !1
13
- }
14
-
15
- return a.prototype.albumLabel = function (a, b) {
16
- return "Image " + a + " of " + b
17
- }, a
18
- }(), c = function () {
19
- function b(a) {
20
- this.options = a, this.album = [], this.currentImageIndex = void 0, this.init()
21
- }
22
-
23
- return b.prototype.init = function () {
24
- this.enable(), this.build()
25
- }, b.prototype.enable = function () {
26
- var b = this;
27
- a("body").on("click", "a[rel^=lightbox], area[rel^=lightbox], a[data-lightbox], area[data-lightbox]", function (c) {
28
- return b.start(a(c.currentTarget)), !1
29
- })
30
- }, b.prototype.build = function () {
31
- var b = this;
32
- a("<div id='lightboxOverlay' class='lightboxOverlay'></div><div id='lightbox' class='lightbox'><div class='lb-outerContainer'><div class='lb-container'><img class='lb-image' src='' /><div class='lb-nav'><a class='lb-prev' href='' ></a><a class='lb-next' href='' ></a></div><div class='lb-loader'><a class='lb-cancel'></a></div></div></div><div class='lb-dataContainer'><div class='lb-data'><div class='lb-details'><span class='lb-caption'></span><span class='lb-number'></span></div><div class='lb-closeContainer'><a class='lb-close'></a></div></div></div></div>").appendTo(a("body")), this.$lightbox = a("#lightbox"), this.$overlay = a("#lightboxOverlay"), this.$outerContainer = this.$lightbox.find(".lb-outerContainer"), this.$container = this.$lightbox.find(".lb-container"), this.containerTopPadding = parseInt(this.$container.css("padding-top"), 10), this.containerRightPadding = parseInt(this.$container.css("padding-right"), 10), this.containerBottomPadding = parseInt(this.$container.css("padding-bottom"), 10), this.containerLeftPadding = parseInt(this.$container.css("padding-left"), 10), this.$overlay.hide().on("click", function () {
33
- return b.end(), !1
34
- }), this.$lightbox.hide().on("click", function (c) {
35
- return "lightbox" === a(c.target).attr("id") && b.end(), !1
36
- }), this.$outerContainer.on("click", function (c) {
37
- return "lightbox" === a(c.target).attr("id") && b.end(), !1
38
- }), this.$lightbox.find(".lb-prev").on("click", function () {
39
- return b.changeImage(0 === b.currentImageIndex ? b.album.length - 1 : b.currentImageIndex - 1), !1
40
- }), this.$lightbox.find(".lb-next").on("click", function () {
41
- return b.changeImage(b.currentImageIndex === b.album.length - 1 ? 0 : b.currentImageIndex + 1), !1
42
- }), this.$lightbox.find(".lb-loader, .lb-close").on("click", function () {
43
- return b.end(), !1
44
- })
45
- }, b.prototype.start = function (b) {
46
- function c(a) {
47
- d.album.push({link: a.attr("href"), title: a.attr("data-title") || a.attr("title")})
48
- }
49
-
50
- var d = this, e = a(window);
51
- e.on("resize", a.proxy(this.sizeOverlay, this)), a("select, object, embed").css({visibility: "hidden"}), this.sizeOverlay(), this.album = [];
52
- var f, g = 0, h = b.attr("data-lightbox");
53
- if (h) {
54
- f = a(b.prop("tagName") + '[data-lightbox="' + h + '"]');
55
- for (var i = 0; i < f.length; i = ++i)c(a(f[i])), f[i] === b[0] && (g = i)
56
- } else if ("lightbox" === b.attr("rel"))c(b); else {
57
- f = a(b.prop("tagName") + '[rel="' + b.attr("rel") + '"]');
58
- for (var j = 0; j < f.length; j = ++j)c(a(f[j])), f[j] === b[0] && (g = j)
59
- }
60
- var k = e.scrollTop() + this.options.positionFromTop, l = e.scrollLeft();
61
- this.$lightbox.css({top: k + "px", left: l + "px"}).fadeIn(this.options.fadeDuration), this.changeImage(g)
62
- }, b.prototype.changeImage = function (b) {
63
- var c = this;
64
- this.disableKeyboardNav();
65
- var d = this.$lightbox.find(".lb-image");
66
- this.$overlay.fadeIn(this.options.fadeDuration), a(".lb-loader").fadeIn("slow"), this.$lightbox.find(".lb-image, .lb-nav, .lb-prev, .lb-next, .lb-dataContainer, .lb-numbers, .lb-caption").hide(), this.$outerContainer.addClass("animating");
67
- var e = new Image;
68
- e.onload = function () {
69
- var f, g, h, i, j, k, l;
70
- d.attr("src", c.album[b].link), f = a(e), d.width(e.width), d.height(e.height), c.options.fitImagesInViewport && (l = a(window).width(), k = a(window).height(), j = l - c.containerLeftPadding - c.containerRightPadding - 20, i = k - c.containerTopPadding - c.containerBottomPadding - 120, (e.width > j || e.height > i) && (e.width / j > e.height / i ? (h = j, g = parseInt(e.height / (e.width / h), 10), d.width(h), d.height(g)) : (g = i, h = parseInt(e.width / (e.height / g), 10), d.width(h), d.height(g)))), c.sizeContainer(d.width(), d.height())
71
- }, e.src = this.album[b].link, this.currentImageIndex = b
72
- }, b.prototype.sizeOverlay = function () {
73
- this.$overlay.width(a(window).width()).height(a(document).height())
74
- }, b.prototype.sizeContainer = function (a, b) {
75
- function c() {
76
- d.$lightbox.find(".lb-dataContainer").width(g), d.$lightbox.find(".lb-prevLink").height(h), d.$lightbox.find(".lb-nextLink").height(h), d.showImage()
77
- }
78
-
79
- var d = this, e = this.$outerContainer.outerWidth(), f = this.$outerContainer.outerHeight(), g = a + this.containerLeftPadding + this.containerRightPadding, h = b + this.containerTopPadding + this.containerBottomPadding;
80
- e !== g || f !== h ? this.$outerContainer.animate({
81
- width: g,
82
- height: h
83
- }, this.options.resizeDuration, "swing", function () {
84
- c()
85
- }) : c()
86
- }, b.prototype.showImage = function () {
87
- this.$lightbox.find(".lb-loader").hide(), this.$lightbox.find(".lb-image").fadeIn("slow"), this.updateNav(), this.updateDetails(), this.preloadNeighboringImages(), this.enableKeyboardNav()
88
- }, b.prototype.updateNav = function () {
89
- var a = !1;
90
- try {
91
- document.createEvent("TouchEvent"), a = this.options.alwaysShowNavOnTouchDevices ? !0 : !1
92
- } catch (b) {
93
- }
94
- this.$lightbox.find(".lb-nav").show(), this.album.length > 1 && (this.options.wrapAround ? (a && this.$lightbox.find(".lb-prev, .lb-next").css("opacity", "1"), this.$lightbox.find(".lb-prev, .lb-next").show()) : (this.currentImageIndex > 0 && (this.$lightbox.find(".lb-prev").show(), a && this.$lightbox.find(".lb-prev").css("opacity", "1")), this.currentImageIndex < this.album.length - 1 && (this.$lightbox.find(".lb-next").show(), a && this.$lightbox.find(".lb-next").css("opacity", "1"))))
95
- }, b.prototype.updateDetails = function () {
96
- var b = this;
97
- "undefined" != typeof this.album[this.currentImageIndex].title && "" !== this.album[this.currentImageIndex].title && this.$lightbox.find(".lb-caption").html(this.album[this.currentImageIndex].title).fadeIn("fast").find("a").on("click", function () {
98
- location.href = a(this).attr("href")
99
- }), this.album.length > 1 && this.options.showImageNumberLabel ? this.$lightbox.find(".lb-number").text(this.options.albumLabel(this.currentImageIndex + 1, this.album.length)).fadeIn("fast") : this.$lightbox.find(".lb-number").hide(), this.$outerContainer.removeClass("animating"), this.$lightbox.find(".lb-dataContainer").fadeIn(this.options.resizeDuration, function () {
100
- return b.sizeOverlay()
101
- })
102
- }, b.prototype.preloadNeighboringImages = function () {
103
- if (this.album.length > this.currentImageIndex + 1) {
104
- var a = new Image;
105
- a.src = this.album[this.currentImageIndex + 1].link
106
- }
107
- if (this.currentImageIndex > 0) {
108
- var b = new Image;
109
- b.src = this.album[this.currentImageIndex - 1].link
110
- }
111
- }, b.prototype.enableKeyboardNav = function () {
112
- a(document).on("keyup.keyboard", a.proxy(this.keyboardAction, this))
113
- }, b.prototype.disableKeyboardNav = function () {
114
- a(document).off(".keyboard")
115
- }, b.prototype.keyboardAction = function (a) {
116
- var b = 27, c = 37, d = 39, e = a.keyCode, f = String.fromCharCode(e).toLowerCase();
117
- e === b || f.match(/x|o|c/) ? this.end() : "p" === f || e === c ? 0 !== this.currentImageIndex ? this.changeImage(this.currentImageIndex - 1) : this.options.wrapAround && this.album.length > 1 && this.changeImage(this.album.length - 1) : ("n" === f || e === d) && (this.currentImageIndex !== this.album.length - 1 ? this.changeImage(this.currentImageIndex + 1) : this.options.wrapAround && this.album.length > 1 && this.changeImage(0))
118
- }, b.prototype.end = function () {
119
- this.disableKeyboardNav(), a(window).off("resize", this.sizeOverlay), this.$lightbox.fadeOut(this.options.fadeDuration), this.$overlay.fadeOut(this.options.fadeDuration), a("select, object, embed").css({visibility: "visible"})
120
- }, b
121
- }();
122
- a(function () {
123
- {
124
- var a = new b;
125
- new c(a)
126
- }
127
- })
128
- }).call(this);
129
- //# sourceMappingURL=lightbox.min.map
1
+ jQuery(function($){function Lightbox(options){this.album=[];this.currentImageIndex=void 0;this.init();this.options=$.extend({},this.constructor.defaults);this.option(options)}Lightbox.defaults={albumLabel:"Image %1 of %2",alwaysShowNavOnTouchDevices:false,fadeDuration:500,fitImagesInViewport:true,positionFromTop:50,resizeDuration:700,showImageNumberLabel:true,wrapAround:false,disableScrolling:false};Lightbox.prototype.option=function(options){$.extend(this.options,options)};Lightbox.prototype.imageCountLabel=function(currentImageNum,totalImages){return this.options.albumLabel.replace(/%1/g,currentImageNum).replace(/%2/g,totalImages)};Lightbox.prototype.init=function(){this.enable();this.build()};Lightbox.prototype.enable=function(){var self=this;$("body").on("click","a[rel^=lightbox], area[rel^=lightbox], a[data-lightbox], area[data-lightbox]",function(event){self.start($(event.currentTarget));return false})};Lightbox.prototype.build=function(){var self=this;$('<div id="lightboxOverlay" class="lightboxOverlay"></div><div id="lightbox" class="lightbox"><div class="lb-outerContainer"><div class="lb-container"><img class="lb-image" src="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==" /><div class="lb-nav"><a class="lb-prev" href="" ></a><a class="lb-next" href="" ></a></div><div class="lb-loader"><a class="lb-cancel"></a></div></div></div><div class="lb-dataContainer"><div class="lb-data"><div class="lb-details"><span class="lb-caption"></span><span class="lb-number"></span></div><div class="lb-closeContainer"><a class="lb-close"></a></div></div></div></div>').appendTo($("body"));this.$lightbox=$("#lightbox");this.$overlay=$("#lightboxOverlay");this.$outerContainer=this.$lightbox.find(".lb-outerContainer");this.$container=this.$lightbox.find(".lb-container");this.containerTopPadding=parseInt(this.$container.css("padding-top"),10);this.containerRightPadding=parseInt(this.$container.css("padding-right"),10);this.containerBottomPadding=parseInt(this.$container.css("padding-bottom"),10);this.containerLeftPadding=parseInt(this.$container.css("padding-left"),10);this.$overlay.hide().on("click",function(){self.end();return false});this.$lightbox.hide().on("click",function(event){if($(event.target).attr("id")==="lightbox"){self.end()}return false});this.$outerContainer.on("click",function(event){if($(event.target).attr("id")==="lightbox"){self.end()}return false});this.$lightbox.find(".lb-prev").on("click",function(){if(self.currentImageIndex===0){self.changeImage(self.album.length-1)}else{self.changeImage(self.currentImageIndex-1)}return false});this.$lightbox.find(".lb-next").on("click",function(){if(self.currentImageIndex===self.album.length-1){self.changeImage(0)}else{self.changeImage(self.currentImageIndex+1)}return false});this.$lightbox.find(".lb-loader, .lb-close").on("click",function(){self.end();return false})};Lightbox.prototype.start=function($link){var self=this;var $window=$(window);$window.on("resize",$.proxy(this.sizeOverlay,this));$("select, object, embed").css({visibility:"hidden"});this.sizeOverlay();this.album=[];var imageNumber=0;function addToAlbum($link){self.album.push({link:$link.attr("href"),title:$link.attr("data-title")||$link.attr("title")})}var dataLightboxValue=$link.attr("data-lightbox");var $links;if(dataLightboxValue){$links=$($link.prop("tagName")+'[data-lightbox="'+dataLightboxValue+'"]');for(var i=0;i<$links.length;i=++i){addToAlbum($($links[i]));if($links[i]===$link[0]){imageNumber=i}}}else{if($link.attr("rel")==="lightbox"){addToAlbum($link)}else{$links=$($link.prop("tagName")+'[rel="'+$link.attr("rel")+'"]');for(var j=0;j<$links.length;j=++j){addToAlbum($($links[j]));if($links[j]===$link[0]){imageNumber=j}}}}var top=$window.scrollTop()+this.options.positionFromTop;var left=$window.scrollLeft();this.$lightbox.css({top:top+"px",left:left+"px"}).fadeIn(this.options.fadeDuration);if(this.options.disableScrolling){$("body").addClass("lb-disable-scrolling")}this.changeImage(imageNumber)};Lightbox.prototype.changeImage=function(imageNumber){var self=this;this.disableKeyboardNav();var $image=this.$lightbox.find(".lb-image");this.$overlay.fadeIn(this.options.fadeDuration);$(".lb-loader").fadeIn("slow");this.$lightbox.find(".lb-image, .lb-nav, .lb-prev, .lb-next, .lb-dataContainer, .lb-numbers, .lb-caption").hide();this.$outerContainer.addClass("animating");var preloader=new Image;preloader.onload=function(){var $preloader;var imageHeight;var imageWidth;var maxImageHeight;var maxImageWidth;var windowHeight;var windowWidth;$image.attr("src",self.album[imageNumber].link);$preloader=$(preloader);$image.width(preloader.width);$image.height(preloader.height);if(self.options.fitImagesInViewport){windowWidth=$(window).width();windowHeight=$(window).height();maxImageWidth=windowWidth-self.containerLeftPadding-self.containerRightPadding-20;maxImageHeight=windowHeight-self.containerTopPadding-self.containerBottomPadding-120;if(self.options.maxWidth&&self.options.maxWidth<maxImageWidth){maxImageWidth=self.options.maxWidth}if(self.options.maxHeight&&self.options.maxHeight<maxImageWidth){maxImageHeight=self.options.maxHeight}if(preloader.width>maxImageWidth||preloader.height>maxImageHeight){if(preloader.width/maxImageWidth>preloader.height/maxImageHeight){imageWidth=maxImageWidth;imageHeight=parseInt(preloader.height/(preloader.width/imageWidth),10);$image.width(imageWidth);$image.height(imageHeight)}else{imageHeight=maxImageHeight;imageWidth=parseInt(preloader.width/(preloader.height/imageHeight),10);$image.width(imageWidth);$image.height(imageHeight)}}}self.sizeContainer($image.width(),$image.height())};preloader.src=this.album[imageNumber].link;this.currentImageIndex=imageNumber};Lightbox.prototype.sizeOverlay=function(){this.$overlay.width($(document).width()).height($(document).height())};Lightbox.prototype.sizeContainer=function(imageWidth,imageHeight){var self=this;var oldWidth=this.$outerContainer.outerWidth();var oldHeight=this.$outerContainer.outerHeight();var newWidth=imageWidth+this.containerLeftPadding+this.containerRightPadding;var newHeight=imageHeight+this.containerTopPadding+this.containerBottomPadding;function postResize(){self.$lightbox.find(".lb-dataContainer").width(newWidth);self.$lightbox.find(".lb-prevLink").height(newHeight);self.$lightbox.find(".lb-nextLink").height(newHeight);self.showImage()}if(oldWidth!==newWidth||oldHeight!==newHeight){this.$outerContainer.animate({width:newWidth,height:newHeight},this.options.resizeDuration,"swing",function(){postResize()})}else{postResize()}};Lightbox.prototype.showImage=function(){this.$lightbox.find(".lb-loader").stop(true).hide();this.$lightbox.find(".lb-image").fadeIn("slow");this.updateNav();this.updateDetails();this.preloadNeighboringImages();this.enableKeyboardNav()};Lightbox.prototype.updateNav=function(){var alwaysShowNav=false;try{document.createEvent("TouchEvent");alwaysShowNav=this.options.alwaysShowNavOnTouchDevices?true:false}catch(e){}this.$lightbox.find(".lb-nav").show();if(this.album.length>1){if(this.options.wrapAround){if(alwaysShowNav){this.$lightbox.find(".lb-prev, .lb-next").css("opacity","1")}this.$lightbox.find(".lb-prev, .lb-next").show()}else{if(this.currentImageIndex>0){this.$lightbox.find(".lb-prev").show();if(alwaysShowNav){this.$lightbox.find(".lb-prev").css("opacity","1")}}if(this.currentImageIndex<this.album.length-1){this.$lightbox.find(".lb-next").show();if(alwaysShowNav){this.$lightbox.find(".lb-next").css("opacity","1")}}}}};Lightbox.prototype.updateDetails=function(){var self=this;if(typeof this.album[this.currentImageIndex].title!=="undefined"&&this.album[this.currentImageIndex].title!==""){this.$lightbox.find(".lb-caption").html(this.album[this.currentImageIndex].title).fadeIn("fast").find("a").on("click",function(event){if($(this).attr("target")!==undefined){window.open($(this).attr("href"),$(this).attr("target"))}else{location.href=$(this).attr("href")}})}if(this.album.length>1&&this.options.showImageNumberLabel){var labelText=this.imageCountLabel(this.currentImageIndex+1,this.album.length);this.$lightbox.find(".lb-number").text(labelText).fadeIn("fast")}else{this.$lightbox.find(".lb-number").hide()}this.$outerContainer.removeClass("animating");this.$lightbox.find(".lb-dataContainer").fadeIn(this.options.resizeDuration,function(){return self.sizeOverlay()})};Lightbox.prototype.preloadNeighboringImages=function(){if(this.album.length>this.currentImageIndex+1){var preloadNext=new Image;preloadNext.src=this.album[this.currentImageIndex+1].link}if(this.currentImageIndex>0){var preloadPrev=new Image;preloadPrev.src=this.album[this.currentImageIndex-1].link}};Lightbox.prototype.enableKeyboardNav=function(){$(document).on("keyup.keyboard",$.proxy(this.keyboardAction,this))};Lightbox.prototype.disableKeyboardNav=function(){$(document).off(".keyboard")};Lightbox.prototype.keyboardAction=function(event){var KEYCODE_ESC=27;var KEYCODE_LEFTARROW=37;var KEYCODE_RIGHTARROW=39;var keycode=event.keyCode;var key=String.fromCharCode(keycode).toLowerCase();if(keycode===KEYCODE_ESC||key.match(/x|o|c/)){this.end()}else if(key==="p"||keycode===KEYCODE_LEFTARROW){if(this.currentImageIndex!==0){this.changeImage(this.currentImageIndex-1)}else if(this.options.wrapAround&&this.album.length>1){this.changeImage(this.album.length-1)}}else if(key==="n"||keycode===KEYCODE_RIGHTARROW){if(this.currentImageIndex!==this.album.length-1){this.changeImage(this.currentImageIndex+1)}else if(this.options.wrapAround&&this.album.length>1){this.changeImage(0)}}};Lightbox.prototype.end=function(){this.disableKeyboardNav();$(window).off("resize",this.sizeOverlay);this.$lightbox.fadeOut(this.options.fadeDuration);this.$overlay.fadeOut(this.options.fadeDuration);$("select, object, embed").css({visibility:"visible"});if(this.options.disableScrolling){$("body").removeClass("lb-disable-scrolling")}};if(typeof WEF_LB==="undefined"){new Lightbox}else{for(var key in WEF_LB){if(WEF_LB.hasOwnProperty(key)){if(WEF_LB[key]=="false"){WEF_LB[key]=false}if(WEF_LB[key]=="true"){WEF_LB[key]=true}}}new Lightbox(WEF_LB)}});
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
lib/lightbox2/js/lightbox.min.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"lightbox.min.js","sources":["lightbox.js"],"names":["$","jQuery","LightboxOptions","this","fadeDuration","fitImagesInViewport","resizeDuration","positionFromTop","showImageNumberLabel","alwaysShowNavOnTouchDevices","wrapAround","prototype","albumLabel","curImageNum","albumSize","Lightbox","options","album","currentImageIndex","init","enable","build","self","on","event","start","currentTarget","appendTo","$lightbox","$overlay","$outerContainer","find","$container","containerTopPadding","parseInt","css","containerRightPadding","containerBottomPadding","containerLeftPadding","hide","end","target","attr","changeImage","length","$link","addToAlbum","push","link","title","$window","window","proxy","sizeOverlay","visibility","$links","imageNumber","dataLightboxValue","prop","i","j","top","scrollTop","left","scrollLeft","fadeIn","disableKeyboardNav","$image","addClass","preloader","Image","onload","$preloader","imageHeight","imageWidth","maxImageHeight","maxImageWidth","windowHeight","windowWidth","width","height","sizeContainer","src","document","postResize","newWidth","newHeight","showImage","oldWidth","outerWidth","oldHeight","outerHeight","animate","updateNav","updateDetails","preloadNeighboringImages","enableKeyboardNav","alwaysShowNav","createEvent","e","show","html","location","href","text","removeClass","preloadNext","preloadPrev","keyboardAction","off","KEYCODE_ESC","KEYCODE_LEFTARROW","KEYCODE_RIGHTARROW","keycode","keyCode","key","String","fromCharCode","toLowerCase","match","fadeOut","call"],"mappings":";;;;;;;;CASA,WAEE,GAAIA,GAAIC,OAEJC,EAAkB,WACpB,QAASA,KACPC,KAAKC,aAA8B,IACnCD,KAAKE,qBAA8B,EACnCF,KAAKG,eAA8B,IACnCH,KAAKI,gBAA8B,GACnCJ,KAAKK,sBAA8B,EACnCL,KAAKM,6BAA8B,EACnCN,KAAKO,YAA8B,EAQrC,MAJAR,GAAgBS,UAAUC,WAAa,SAASC,EAAaC,GAC3D,MAAO,SAAWD,EAAc,OAASC,GAGpCZ,KAILa,EAAW,WACb,QAASA,GAASC,GAChBb,KAAKa,QAAoBA,EACzBb,KAAKc,SACLd,KAAKe,kBAAoB,OACzBf,KAAKgB,OA2WP,MAxWAJ,GAASJ,UAAUQ,KAAO,WACxBhB,KAAKiB,SACLjB,KAAKkB,SAKPN,EAASJ,UAAUS,OAAS,WAC1B,GAAIE,GAAOnB,IACXH,GAAE,QAAQuB,GAAG,QAAS,+EAAgF,SAASC,GAE7G,MADAF,GAAKG,MAAMzB,EAAEwB,EAAME,iBACZ,KAMXX,EAASJ,UAAUU,MAAQ,WACzB,GAAIC,GAAOnB,IACXH,GAAE,mjBAAmjB2B,SAAS3B,EAAE,SAGhkBG,KAAKyB,UAAkB5B,EAAE,aACzBG,KAAK0B,SAAkB7B,EAAE,oBACzBG,KAAK2B,gBAAkB3B,KAAKyB,UAAUG,KAAK,sBAC3C5B,KAAK6B,WAAkB7B,KAAKyB,UAAUG,KAAK,iBAG3C5B,KAAK8B,oBAAsBC,SAAS/B,KAAK6B,WAAWG,IAAI,eAAgB,IACxEhC,KAAKiC,sBAAwBF,SAAS/B,KAAK6B,WAAWG,IAAI,iBAAkB,IAC5EhC,KAAKkC,uBAAyBH,SAAS/B,KAAK6B,WAAWG,IAAI,kBAAmB,IAC9EhC,KAAKmC,qBAAuBJ,SAAS/B,KAAK6B,WAAWG,IAAI,gBAAiB,IAG1EhC,KAAK0B,SAASU,OAAOhB,GAAG,QAAS,WAE/B,MADAD,GAAKkB,OACE,IAGTrC,KAAKyB,UAAUW,OAAOhB,GAAG,QAAS,SAASC,GAIzC,MAHmC,aAA/BxB,EAAEwB,EAAMiB,QAAQC,KAAK,OACvBpB,EAAKkB,OAEA,IAGTrC,KAAK2B,gBAAgBP,GAAG,QAAS,SAASC,GAIxC,MAHmC,aAA/BxB,EAAEwB,EAAMiB,QAAQC,KAAK,OACvBpB,EAAKkB,OAEA,IAGTrC,KAAKyB,UAAUG,KAAK,YAAYR,GAAG,QAAS,WAM1C,MAJED,GAAKqB,YADwB,IAA3BrB,EAAKJ,kBACUI,EAAKL,MAAM2B,OAAS,EAEpBtB,EAAKJ,kBAAoB,IAErC,IAGTf,KAAKyB,UAAUG,KAAK,YAAYR,GAAG,QAAS,WAM1C,MAJED,GAAKqB,YADHrB,EAAKJ,oBAAsBI,EAAKL,MAAM2B,OAAS,EAChC,EAEAtB,EAAKJ,kBAAoB,IAErC,IAGTf,KAAKyB,UAAUG,KAAK,yBAAyBR,GAAG,QAAS,WAEvD,MADAD,GAAKkB,OACE,KAKXzB,EAASJ,UAAUc,MAAQ,SAASoB,GAelC,QAASC,GAAWD,GAClBvB,EAAKL,MAAM8B,MACTC,KAAMH,EAAMH,KAAK,QACjBO,MAAOJ,EAAMH,KAAK,eAAiBG,EAAMH,KAAK,WAjBlD,GAAIpB,GAAUnB,KACV+C,EAAUlD,EAAEmD,OAEhBD,GAAQ3B,GAAG,SAAUvB,EAAEoD,MAAMjD,KAAKkD,YAAalD,OAE/CH,EAAE,yBAAyBmC,KACzBmB,WAAY,WAGdnD,KAAKkD,cAELlD,KAAKc,QACL,IAWIsC,GAXAC,EAAc,EAUdC,EAAoBZ,EAAMH,KAAK,gBAGnC,IAAIe,EAAmB,CACrBF,EAASvD,EAAE6C,EAAMa,KAAK,WAAa,mBAAqBD,EAAoB,KAC5E,KAAK,GAAIE,GAAI,EAAGA,EAAIJ,EAAOX,OAAQe,IAAMA,EACvCb,EAAW9C,EAAEuD,EAAOI,KAChBJ,EAAOI,KAAOd,EAAM,KACtBW,EAAcG,OAIlB,IAA0B,aAAtBd,EAAMH,KAAK,OAEbI,EAAWD,OACN,CAELU,EAASvD,EAAE6C,EAAMa,KAAK,WAAa,SAAWb,EAAMH,KAAK,OAAS,KAClE,KAAK,GAAIkB,GAAI,EAAGA,EAAIL,EAAOX,OAAQgB,IAAMA,EACvCd,EAAW9C,EAAEuD,EAAOK,KAChBL,EAAOK,KAAOf,EAAM,KACtBW,EAAcI,GAOtB,GAAIC,GAAOX,EAAQY,YAAc3D,KAAKa,QAAQT,gBAC1CwD,EAAOb,EAAQc,YACnB7D,MAAKyB,UAAUO,KACb0B,IAAKA,EAAM,KACXE,KAAMA,EAAO,OACZE,OAAO9D,KAAKa,QAAQZ,cAEvBD,KAAKwC,YAAYa,IAInBzC,EAASJ,UAAUgC,YAAc,SAASa,GACxC,GAAIlC,GAAOnB,IAEXA,MAAK+D,oBACL,IAAIC,GAAShE,KAAKyB,UAAUG,KAAK,YAEjC5B,MAAK0B,SAASoC,OAAO9D,KAAKa,QAAQZ,cAElCJ,EAAE,cAAciE,OAAO,QACvB9D,KAAKyB,UAAUG,KAAK,uFAAuFQ,OAE3GpC,KAAK2B,gBAAgBsC,SAAS,YAG9B,IAAIC,GAAY,GAAIC,MACpBD,GAAUE,OAAS,WACjB,GAAIC,GAAYC,EAAaC,EAAYC,EAAgBC,EAAeC,EAAcC,CACtFX,GAAOzB,KAAK,MAAOpB,EAAKL,MAAMuC,GAAaR,MAE3CwB,EAAaxE,EAAEqE,GAEfF,EAAOY,MAAMV,EAAUU,OACvBZ,EAAOa,OAAOX,EAAUW,QAEpB1D,EAAKN,QAAQX,sBAIfyE,EAAiB9E,EAAEmD,QAAQ4B,QAC3BF,EAAiB7E,EAAEmD,QAAQ6B,SAC3BJ,EAAiBE,EAAcxD,EAAKgB,qBAAuBhB,EAAKc,sBAAwB,GACxFuC,EAAiBE,EAAevD,EAAKW,oBAAsBX,EAAKe,uBAAyB,KAGpFgC,EAAUU,MAAQH,GAAmBP,EAAUW,OAASL,KACtDN,EAAUU,MAAQH,EAAkBP,EAAUW,OAASL,GAC1DD,EAAcE,EACdH,EAAcvC,SAASmC,EAAUW,QAAUX,EAAUU,MAAQL,GAAa,IAC1EP,EAAOY,MAAML,GACbP,EAAOa,OAAOP,KAEdA,EAAcE,EACdD,EAAaxC,SAASmC,EAAUU,OAASV,EAAUW,OAASP,GAAc,IAC1EN,EAAOY,MAAML,GACbP,EAAOa,OAAOP,MAIpBnD,EAAK2D,cAAcd,EAAOY,QAASZ,EAAOa,WAG5CX,EAAUa,IAAe/E,KAAKc,MAAMuC,GAAaR,KACjD7C,KAAKe,kBAAoBsC,GAI3BzC,EAASJ,UAAU0C,YAAc,WAC/BlD,KAAK0B,SACFkD,MAAM/E,EAAEmD,QAAQ4B,SAChBC,OAAOhF,EAAEmF,UAAUH,WAIxBjE,EAASJ,UAAUsE,cAAgB,SAASP,EAAYD,GAQtD,QAASW,KACP9D,EAAKM,UAAUG,KAAK,qBAAqBgD,MAAMM,GAC/C/D,EAAKM,UAAUG,KAAK,gBAAgBiD,OAAOM,GAC3ChE,EAAKM,UAAUG,KAAK,gBAAgBiD,OAAOM,GAC3ChE,EAAKiE,YAXP,GAAIjE,GAAOnB,KAEPqF,EAAYrF,KAAK2B,gBAAgB2D,aACjCC,EAAYvF,KAAK2B,gBAAgB6D,cACjCN,EAAYX,EAAavE,KAAKmC,qBAAuBnC,KAAKiC,sBAC1DkD,EAAYb,EAActE,KAAK8B,oBAAsB9B,KAAKkC,sBAS1DmD,KAAaH,GAAYK,IAAcJ,EACzCnF,KAAK2B,gBAAgB8D,SACnBb,MAAOM,EACPL,OAAQM,GACPnF,KAAKa,QAAQV,eAAgB,QAAS,WACvC8E,MAGFA,KAKJrE,EAASJ,UAAU4E,UAAY,WAC7BpF,KAAKyB,UAAUG,KAAK,cAAcQ,OAClCpC,KAAKyB,UAAUG,KAAK,aAAakC,OAAO,QAExC9D,KAAK0F,YACL1F,KAAK2F,gBACL3F,KAAK4F,2BACL5F,KAAK6F,qBAIPjF,EAASJ,UAAUkF,UAAY,WAI7B,GAAII,IAAgB,CACpB,KACEd,SAASe,YAAY,cACrBD,EAAiB9F,KAAKa,QAAmC,6BAAG,GAAM,EAClE,MAAOmF,IAEThG,KAAKyB,UAAUG,KAAK,WAAWqE,OAE3BjG,KAAKc,MAAM2B,OAAS,IAClBzC,KAAKa,QAAQN,YACXuF,GACF9F,KAAKyB,UAAUG,KAAK,sBAAsBI,IAAI,UAAW,KAE3DhC,KAAKyB,UAAUG,KAAK,sBAAsBqE,SAEtCjG,KAAKe,kBAAoB,IAC3Bf,KAAKyB,UAAUG,KAAK,YAAYqE,OAC5BH,GACF9F,KAAKyB,UAAUG,KAAK,YAAYI,IAAI,UAAW,MAG/ChC,KAAKe,kBAAoBf,KAAKc,MAAM2B,OAAS,IAC/CzC,KAAKyB,UAAUG,KAAK,YAAYqE,OAC5BH,GACF9F,KAAKyB,UAAUG,KAAK,YAAYI,IAAI,UAAW,SAQzDpB,EAASJ,UAAUmF,cAAgB,WACjC,GAAIxE,GAAOnB,IAI6C,oBAA7CA,MAAKc,MAAMd,KAAKe,mBAAmB+B,OAAsE,KAA7C9C,KAAKc,MAAMd,KAAKe,mBAAmB+B,OACxG9C,KAAKyB,UAAUG,KAAK,eACjBsE,KAAKlG,KAAKc,MAAMd,KAAKe,mBAAmB+B,OACxCgB,OAAO,QACPlC,KAAK,KAAKR,GAAG,QAAS,WACrB+E,SAASC,KAAOvG,EAAEG,MAAMuC,KAAK,UAI/BvC,KAAKc,MAAM2B,OAAS,GAAKzC,KAAKa,QAAQR,qBACxCL,KAAKyB,UAAUG,KAAK,cAAcyE,KAAKrG,KAAKa,QAAQJ,WAAWT,KAAKe,kBAAoB,EAAGf,KAAKc,MAAM2B,SAASqB,OAAO,QAEtH9D,KAAKyB,UAAUG,KAAK,cAAcQ,OAGpCpC,KAAK2B,gBAAgB2E,YAAY,aAEjCtG,KAAKyB,UAAUG,KAAK,qBAAqBkC,OAAO9D,KAAKa,QAAQV,eAAgB,WAC3E,MAAOgB,GAAK+B,iBAKhBtC,EAASJ,UAAUoF,yBAA2B,WAC5C,GAAI5F,KAAKc,MAAM2B,OAASzC,KAAKe,kBAAoB,EAAG,CAClD,GAAIwF,GAAc,GAAIpC,MACtBoC,GAAYxB,IAAM/E,KAAKc,MAAMd,KAAKe,kBAAoB,GAAG8B,KAE3D,GAAI7C,KAAKe,kBAAoB,EAAG,CAC9B,GAAIyF,GAAc,GAAIrC,MACtBqC,GAAYzB,IAAM/E,KAAKc,MAAMd,KAAKe,kBAAoB,GAAG8B,OAI7DjC,EAASJ,UAAUqF,kBAAoB,WACrChG,EAAEmF,UAAU5D,GAAG,iBAAkBvB,EAAEoD,MAAMjD,KAAKyG,eAAgBzG,QAGhEY,EAASJ,UAAUuD,mBAAqB,WACtClE,EAAEmF,UAAU0B,IAAI,cAGlB9F,EAASJ,UAAUiG,eAAiB,SAASpF,GAC3C,GAAIsF,GAAqB,GACrBC,EAAqB,GACrBC,EAAqB,GAErBC,EAAUzF,EAAM0F,QAChBC,EAAUC,OAAOC,aAAaJ,GAASK,aACvCL,KAAYH,GAAeK,EAAII,MAAM,SACvCpH,KAAKqC,MACY,MAAR2E,GAAeF,IAAYF,EACL,IAA3B5G,KAAKe,kBACPf,KAAKwC,YAAYxC,KAAKe,kBAAoB,GACjCf,KAAKa,QAAQN,YAAcP,KAAKc,MAAM2B,OAAS,GACxDzC,KAAKwC,YAAYxC,KAAKc,MAAM2B,OAAS,IAEtB,MAARuE,GAAeF,IAAYD,KAChC7G,KAAKe,oBAAsBf,KAAKc,MAAM2B,OAAS,EACjDzC,KAAKwC,YAAYxC,KAAKe,kBAAoB,GACjCf,KAAKa,QAAQN,YAAcP,KAAKc,MAAM2B,OAAS,GACxDzC,KAAKwC,YAAY,KAMvB5B,EAASJ,UAAU6B,IAAM,WACvBrC,KAAK+D,qBACLlE,EAAEmD,QAAQ0D,IAAI,SAAU1G,KAAKkD,aAC7BlD,KAAKyB,UAAU4F,QAAQrH,KAAKa,QAAQZ,cACpCD,KAAK0B,SAAS2F,QAAQrH,KAAKa,QAAQZ,cACnCJ,EAAE,yBAAyBmC,KACzBmB,WAAY,aAITvC,IAITf,GAAE,WACA,CAAA,GAAIgB,GAAW,GAAId,EACJ,IAAIa,GAASC,QAG7ByG,KAAKtH"}
 
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.5
7
- Stable tag: 2.0.9.1
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -22,7 +22,7 @@ Embed any **public** facebook video, page, post, profile, photo or event directl
22
  * Facebook Fan pages
23
  * Facebook Community pages
24
  * Facebook Profiles
25
- * Facebook Publications
26
 
27
  **[Live Demo](http://www.wpembedfb.com/demo/)**
28
 
@@ -73,13 +73,48 @@ This can only be achieved using the premium version
73
 
74
  == Screenshots ==
75
 
76
- 1. Fan Page Embed
77
- 2. Album
78
- 3. Profile
79
- 4. Event
 
 
 
 
 
 
 
 
 
 
 
 
80
 
81
  == Changelog ==
82
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
83
  = 2.0.9.1 =
84
  * Fixed Admin notice bug
85
  * Lightbox css improved
@@ -292,5 +327,5 @@ This can only be achieved using the premium version
292
 
293
  == Upgrade Notice ==
294
 
295
- = 2.0.9.1 =
296
- * Fixed Admin notice bug and Lightbox css improved
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.5.2
7
+ Stable tag: 2.1
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
22
  * Facebook Fan pages
23
  * Facebook Community pages
24
  * Facebook Profiles
25
+ * Facebook Posts
26
 
27
  **[Live Demo](http://www.wpembedfb.com/demo/)**
28
 
73
 
74
  == Screenshots ==
75
 
76
+ 1. Fan Page Social Plugin
77
+ 2. Fan Page Custom Embed
78
+ 3. Video Social Plugin
79
+ 4. Video Custom Embed
80
+ 5. Album
81
+ 6. Album with more than 100 photos (Premium only)
82
+ 7. Event
83
+ 8. Full Event Shortcode (Premium only)
84
+ 9. Full Page Shortcode (Premium only)
85
+ 10. Fan page upcoming events (Premium only)
86
+ 11. Post Social Plugin
87
+ 12. Post Custom Embed
88
+ 13. Photo Custom embed
89
+ 14. Settings
90
+ 15. Profile
91
+
92
 
93
  == Changelog ==
94
 
95
+ = 2.1 =
96
+ * Removed all options and moved them to a single one 'wpemfb_options'
97
+ * Removed resize cover javascript it is now done with css
98
+ * Fixed timezone bug custom post and events
99
+ * Added option to only load scripts when an embed is present
100
+ * Added option to reset all options
101
+ * Added Jetpack Photon compatibility
102
+ * Added X Theme compatibility
103
+ * Added lightbox.sass for theme developers
104
+ * Updated Lightbox script and style
105
+ * Added Lightbox Option Album Label
106
+ * Added Lightbox Option Always Show Nav On Touch Devices
107
+ * Added Lightbox Option Show Image Number Label
108
+ * Added Lightbox Option Wrap Around
109
+ * Added Lightbox Option Disable Scrolling
110
+ * Added Lightbox Option Fit Images In Viewport
111
+ * Added Lightbox Option Max Width
112
+ * Added Lightbox Option Max Height
113
+ * Added Lightbox Option Position From Top
114
+ * Added Lightbox Option Resize Duration
115
+ * Added Lightbox Option Fade Duration
116
+ * Changed css on classic theme
117
+
118
  = 2.0.9.1 =
119
  * Fixed Admin notice bug
120
  * Lightbox css improved
327
 
328
  == Upgrade Notice ==
329
 
330
+ = 2.1 =
331
+ 2.1 version is a lot faster and provides full compatibility with Jetpack Photon and some premium "drag and drop" themes all options have been moved to a single one 'wpemfb_options' and new features where added: Enqueue styles and scripts only when an embed is present, 11 Lightbox options like 'Disable Scrolling' 'Loop though Album' etc. Cover resize now done with css
templates/classic/album.php CHANGED
@@ -1,4 +1,4 @@
1
- <div class="wef-classic" style="max-width: <?php echo $width ?>px">
2
  <div class="row">
3
  <div class="col-3 text-center">
4
  <a href="https://facebook.com/<?php /** @noinspection PhpUndefinedVariableInspection */
@@ -22,14 +22,15 @@
22
  <div class="col-12 text-center">
23
  <div class="text-center album-thumbs">
24
  <?php
25
- foreach ($fb_data['photos']['data'] as $pic) {
26
- $data_title = isset($pic['name']) ? $pic['name'] : $fb_data['from']['name'];
27
- ?>
28
- <a class="road-trip" href="<?php echo $pic['source'] ?>" data-lightbox="roadtrip" data-title="<?php echo esc_attr(wp_rel_nofollow(make_clickable($data_title))) ?>" >
29
- <img class="thumbnail" src="<?php echo $pic['picture'] ?>" />
30
- </a>
31
- <?php
32
- }
 
33
  ?>
34
  </div>
35
  </div>
1
+ <div class="wef-classic aligncenter" style="max-width: <?php echo $width ?>px">
2
  <div class="row">
3
  <div class="col-3 text-center">
4
  <a href="https://facebook.com/<?php /** @noinspection PhpUndefinedVariableInspection */
22
  <div class="col-12 text-center">
23
  <div class="text-center album-thumbs">
24
  <?php
25
+ if(isset($fb_data['photos']))
26
+ foreach ($fb_data['photos']['data'] as $pic) {
27
+ $data_title = isset($pic['name']) ? $pic['name'] : '';
28
+ ?>
29
+ <a href="<?php echo $pic['source'] ?>" data-lightbox="roadtrip" <?php echo !empty($data_title) ? 'data-title="'.esc_attr(wp_rel_nofollow(make_clickable(str_replace(array('"',"'"),array('&#34;','&#39;'),$data_title)))).'"' : '' ?> >
30
+ <img class="thumbnail" src="<?php echo $pic['picture'] ?>" />
31
+ </a>
32
+ <?php
33
+ }
34
  ?>
35
  </div>
36
  </div>
templates/classic/classic.css CHANGED
@@ -1,189 +1 @@
1
- .wef-classic {
2
- font: 300 14px/20px Helvetica;
3
- padding: 10px;
4
- display: inline-block;
5
- border-width: 1px;
6
- border-style: solid;
7
- border-color: #23487f;
8
- width: 100%;
9
- background-color: white; }
10
- .wef-classic .row {
11
- margin-left: -10px;
12
- margin-right: -10px;
13
- display: table;
14
- width: 100%; }
15
- .wef-classic .col-1, .wef-classic .col-2, .wef-classic .col-3, .wef-classic .col-4, .wef-classic .col-5, .wef-classic .col-6, .wef-classic .col-7, .wef-classic .col-8, .wef-classic .col-9, .wef-classic .col-10, .wef-classic .col-11, .wef-classic .col-12 {
16
- /* float: left */
17
- position: relative;
18
- min-height: 1px;
19
- padding-left: 10px;
20
- padding-right: 10px;
21
- display: table-cell;
22
- vertical-align: middle;
23
- text-align: left; }
24
- .wef-classic .col-12 {
25
- width: 100%; }
26
- .wef-classic .col-11 {
27
- width: 91.66667%; }
28
- .wef-classic .col-10 {
29
- width: 83.33333%; }
30
- .wef-classic .col-9 {
31
- width: 75%; }
32
- .wef-classic .col-8 {
33
- width: 66.66667%; }
34
- .wef-classic .col-7 {
35
- width: 58.33333%; }
36
- .wef-classic .col-6 {
37
- width: 50%; }
38
- .wef-classic .col-5 {
39
- width: 41.66667%; }
40
- .wef-classic .col-4 {
41
- width: 33.33333%; }
42
- .wef-classic .col-3 {
43
- width: 25%; }
44
- .wef-classic .col-2 {
45
- width: 16.66667%; }
46
- .wef-classic .col-1 {
47
- width: 8.33333%; }
48
- .wef-classic hr {
49
- margin-top: 10px !important;
50
- margin-bottom: 10px !important;
51
- margin-left: 0 !important;
52
- margin-right: 0 !important;
53
- float: none !important;
54
- border-top: 1px;
55
- border-style: solid;
56
- border-color: #23487f;
57
- -moz-box-sizing: content-box;
58
- -webkit-box-sizing: content-box;
59
- box-sizing: content-box;
60
- height: 0 !important;
61
- width: 100% !important; }
62
- .wef-classic img.icon {
63
- float: right;
64
- box-shadow: none;
65
- margin: 0;
66
- padding: 0;
67
- display: block; }
68
- .wef-classic img.thumbnail {
69
- border: 1px solid gray;
70
- border-radius: 2px;
71
- height: 60px !important;
72
- margin: 1px;
73
- padding: 2px;
74
- width: 60px !important; }
75
- .wef-classic .album-thumbs {
76
- line-height: 1px !important; }
77
- .wef-classic a {
78
- font: 300 14px/20px Helvetica;
79
- color: #23487f !important;
80
- text-decoration: none !important;
81
- border: 0 !important;
82
- margin: 0 !important;
83
- padding: 0 !important;
84
- box-shadow: none !important; }
85
- .wef-classic a:focus, .wef-classic a:hover {
86
- color: #23487f;
87
- text-decoration: underline !important; }
88
- .wef-classic a.post-likes {
89
- color: #6d84b4 !important;
90
- font-size: 12px !important; }
91
- .wef-classic a.road-trip {
92
- width: 0 !important;
93
- height: 0 !important; }
94
- .wef-classic a img {
95
- display: inline-block !important; }
96
- .wef-classic p {
97
- font: 300 14px/20px Helvetica;
98
- padding: 0 !important;
99
- margin: 0 !important; }
100
- .wef-classic p.post-time {
101
- font-style: italic;
102
- color: #8e8c8d;
103
- font-size: 12px; }
104
- .wef-classic p.caption-title {
105
- font-size: 12px;
106
- font-weight: bold; }
107
- .wef-classic p.caption-link {
108
- text-align: right;
109
- word-break: break-all; }
110
- .wef-classic p.caption-link a {
111
- font-size: 12px;
112
- color: #8e8c8d !important;
113
- text-transform: uppercase; }
114
- .wef-classic iframe, .wef-classic embed, .wef-classic object, .wef-classic video, .wef-classic audio {
115
- width: 100% !important;
116
- border: 0 !important;
117
- margin: 0 !important;
118
- padding: 0 !important; }
119
- .wef-classic .post-link {
120
- border-width: 1px;
121
- border-style: solid;
122
- border-color: #d0d0d0; }
123
- .wef-classic .post-link p {
124
- padding-left: 10px !important;
125
- padding-right: 10px !important; }
126
- .wef-classic .text-center {
127
- text-align: center; }
128
- .wef-classic .pl-none {
129
- padding-left: 0 !important;
130
- word-break: break-all; }
131
- .wef-classic .color {
132
- color: #23487f; }
133
- .wef-classic .bold {
134
- font-weight: bold !important; }
135
- .wef-classic .title {
136
- font-size: 20px !important;
137
- font-weight: bold !important;
138
- word-break: break-all;
139
- display: inherit !important;
140
- height: 100% !important;
141
- background-color: transparent !important;
142
- padding-top: 5px !important; }
143
- .wef-classic .cover {
144
- width: 100%;
145
- background-size: 100% !important;
146
- cursor: pointer; }
147
- .wef-classic .pad-top {
148
- padding-top: 5px; }
149
- .wef-classic .page-post {
150
- left: 2.6% !important; }
151
- .wef-classic .caption-description p {
152
- color: #8e8c8d !important;
153
- font-style: italic !important;
154
- font-size: 12px !important; }
155
- .wef-classic .video {
156
- position: relative;
157
- display: block;
158
- height: 0;
159
- padding: 0 0 56.25%;
160
- overflow: hidden; }
161
- .wef-classic .video iframe, .wef-classic .video embed, .wef-classic .video object, .wef-classic .video video {
162
- position: absolute;
163
- top: 0;
164
- left: 0;
165
- bottom: 0;
166
- height: 100%;
167
- width: 100%;
168
- border: 0;
169
- margin: 0;
170
- padding: 0; }
171
- .wef-classic .wef-measure {
172
- width: 100%; }
173
- .wef-classic .break-all {
174
- word-break: break-all; }
175
- .wef-classic .event_address {
176
- color: #565656;
177
- font-size: 12px; }
178
-
179
- .wef-video-link {
180
- margin: 0 !important;
181
- padding: 0 !important; }
182
- .wef-video-link a {
183
- font: 300 14px/20px Helvetica;
184
- color: #23487f !important;
185
- text-decoration: none !important;
186
- border: 0 !important;
187
- margin: 0 !important;
188
- padding: 0 !important;
189
- box-shadow: none !important; }
1
+ .wef-classic{font:300 14px/20px Helvetica;padding:10px;display:inline-block;border-width:1px;border-style:solid;border-color:#23487f;box-shadow:1px 1px 2px #23487f;width:100%;background-color:#fff}.wef-classic .row{margin-left:-10px;margin-right:-10px;display:table;width:100%}.wef-classic .col-1,.wef-classic .col-2,.wef-classic .col-3,.wef-classic .col-4,.wef-classic .col-5,.wef-classic .col-6,.wef-classic .col-7,.wef-classic .col-8,.wef-classic .col-9,.wef-classic .col-10,.wef-classic .col-11,.wef-classic .col-12{position:relative;min-height:1px;padding-left:10px;padding-right:10px;display:table-cell;vertical-align:middle;text-align:left}.wef-classic .col-12{width:100%}.wef-classic .col-11{width:91.66667%}.wef-classic .col-10{width:83.33333%}.wef-classic .col-9{width:75%}.wef-classic .col-8{width:66.66667%}.wef-classic .col-7{width:58.33333%}.wef-classic .col-6{width:50%}.wef-classic .col-5{width:41.66667%}.wef-classic .col-4{width:33.33333%}.wef-classic .col-3{width:25%}.wef-classic .col-2{width:16.66667%}.wef-classic .col-1{width:8.33333%}.wef-classic hr{margin-top:10px !important;margin-bottom:10px !important;margin-left:0 !important;margin-right:0 !important;float:none !important;border-top:1px;border-style:solid;border-color:#23487f;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;box-sizing:content-box;height:0 !important;width:100% !important}.wef-classic img.icon{float:right;box-shadow:none;margin:0;padding:0;display:block}.wef-classic img.thumbnail{border:1px solid gray;border-radius:2px;height:60px !important;margin:1px;padding:2px;width:60px !important}.wef-classic .album-thumbs{line-height:1px !important}.wef-classic a{font:300 14px/20px Helvetica;color:#23487f !important;text-decoration:none !important;border:0 !important;margin:0 !important;padding:0 !important;box-shadow:none !important}.wef-classic a:focus,.wef-classic a:hover{color:#23487f;text-decoration:underline !important}.wef-classic a.post-likes{color:#6d84b4 !important;font-size:12px !important}.wef-classic a.road-trip{width:0 !important;height:0 !important}.wef-classic a img{display:inline-block !important;margin:0;padding:0}.wef-classic p{font:300 14px/20px Helvetica;padding:0 !important;margin:0 !important}.wef-classic p.post-time{font-style:italic;color:#8e8c8d;font-size:12px}.wef-classic p.caption-link{text-align:right;word-break:break-all}.wef-classic p.caption-link a{font-size:12px;color:#8e8c8d !important;text-transform:uppercase}.wef-classic p.caption-title{text-align:left}.wef-classic p.caption-title a{font-size:12px;font-weight:bold}.wef-classic iframe,.wef-classic embed,.wef-classic object,.wef-classic video,.wef-classic audio{width:100% !important;border:0 !important;margin:0 !important;padding:0 !important}.wef-classic .post-link{border-width:1px;border-style:solid;border-color:#d0d0d0;box-shadow:1px 1px 2px #b3b3b3}.wef-classic .post-link p{padding-left:10px !important;padding-right:10px !important}.wef-classic .text-center{text-align:center}.wef-classic .pl-none{padding-left:0 !important;word-break:break-all}.wef-classic .color{color:#23487f}.wef-classic .bold{font-weight:bold !important}.wef-classic .title{font-size:20px !important;font-weight:bold !important;word-break:break-all;display:inherit !important;height:100% !important;background-color:transparent !important;padding-top:5px !important}.wef-classic .pad-top{padding-top:5px}.wef-classic .page-post{left:2.6% !important}.wef-classic .caption-description p{color:#8e8c8d !important;font-style:italic !important;font-size:12px !important}.wef-classic .wef-measure{width:100%}.wef-classic .break-all{word-break:break-all}.wef-classic .event_address{color:#565656;font-size:12px}.wef-classic .relative-container{position:relative;display:block;height:0;overflow:hidden}.wef-classic .relative-container .relative,.wef-classic .relative-container .video iframe,.wef-classic .video .relative-container iframe,.wef-classic .relative-container .video embed,.wef-classic .video .relative-container embed,.wef-classic .relative-container .video object,.wef-classic .video .relative-container object,.wef-classic .relative-container .video video,.wef-classic .video .relative-container video{position:absolute;top:0;left:0;bottom:0;height:100%;width:100%;border:0;margin:0;padding:0}.wef-classic .video{padding:0 0 56.25%}.wef-classic .fbpost-image{padding:0 0 52.34%}.wef-classic .fbpost-image div{cursor:pointer;background-size:cover;background-position:50% 50%}.wef-classic .cover{padding:0 0 36.86%}.wef-classic .cover div{background-size:100% !important;background-position-x:0;cursor:pointer}.wef-video-link{margin:0 !important;padding:0 !important}.wef-video-link a{font:300 14px/20px Helvetica;color:#23487f !important;text-decoration:none !important;border:0 !important;margin:0 !important;padding:0 !important;box-shadow:none !important}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
templates/classic/classic.sass CHANGED
@@ -6,6 +6,7 @@
6
  width: 1px
7
  style: solid
8
  color: #23487F
 
9
  width: 100%
10
  background-color: #FFFFFF
11
  .row
@@ -99,6 +100,8 @@
99
  height: 0 !important
100
  img
101
  display: inline-block !important
 
 
102
  p
103
  font: 300 14px/20px Helvetica
104
  padding: 0 !important
@@ -107,9 +110,6 @@
107
  font-style: italic
108
  color: #8e8c8d
109
  font-size: 12px
110
- &.caption-title
111
- font-size: 12px
112
- font-weight: bold
113
  &.caption-link
114
  text-align: right
115
  word-break: break-all
@@ -117,6 +117,11 @@
117
  font-size: 12px
118
  color: #8e8c8d !important
119
  text-transform: uppercase
 
 
 
 
 
120
  iframe, embed, object, video, audio
121
  width: 100% !important
122
  border: 0 !important
@@ -127,6 +132,7 @@
127
  width: 1px
128
  style: solid
129
  color: #d0d0d0
 
130
  p
131
  padding:
132
  left: 10px !important
@@ -148,10 +154,6 @@
148
  height: 100% !important
149
  background-color: transparent !important
150
  padding-top: 5px !important
151
- .cover
152
- width: 100%
153
- background-size: 100% !important
154
- cursor: pointer
155
  .pad-top
156
  padding:
157
  top: 5px
@@ -161,13 +163,19 @@
161
  color: #8e8c8d !important
162
  font-style: italic !important
163
  font-size: 12px !important
164
- .video
 
 
 
 
 
 
 
165
  position: relative
166
  display: block
167
  height: 0
168
- padding: 0 0 56.25%
169
  overflow: hidden
170
- iframe, embed, object, video
171
  position: absolute
172
  top: 0
173
  left: 0
@@ -177,13 +185,23 @@
177
  border: 0
178
  margin: 0
179
  padding: 0
180
- .wef-measure
181
- width: 100%
182
- .break-all
183
- word-break: break-all
184
- .event_address
185
- color: #565656
186
- font-size: 12px
 
 
 
 
 
 
 
 
 
 
187
  .wef-video-link
188
  margin: 0 !important
189
  padding: 0 !important
6
  width: 1px
7
  style: solid
8
  color: #23487F
9
+ box-shadow: 1px 1px 2px #23487F
10
  width: 100%
11
  background-color: #FFFFFF
12
  .row
100
  height: 0 !important
101
  img
102
  display: inline-block !important
103
+ margin: 0
104
+ padding: 0
105
  p
106
  font: 300 14px/20px Helvetica
107
  padding: 0 !important
110
  font-style: italic
111
  color: #8e8c8d
112
  font-size: 12px
 
 
 
113
  &.caption-link
114
  text-align: right
115
  word-break: break-all
117
  font-size: 12px
118
  color: #8e8c8d !important
119
  text-transform: uppercase
120
+ &.caption-title
121
+ text-align: left
122
+ a
123
+ font-size: 12px
124
+ font-weight: bold
125
  iframe, embed, object, video, audio
126
  width: 100% !important
127
  border: 0 !important
132
  width: 1px
133
  style: solid
134
  color: #d0d0d0
135
+ box-shadow: 1px 1px 2px #b3b3b3
136
  p
137
  padding:
138
  left: 10px !important
154
  height: 100% !important
155
  background-color: transparent !important
156
  padding-top: 5px !important
 
 
 
 
157
  .pad-top
158
  padding:
159
  top: 5px
163
  color: #8e8c8d !important
164
  font-style: italic !important
165
  font-size: 12px !important
166
+ .wef-measure
167
+ width: 100%
168
+ .break-all
169
+ word-break: break-all
170
+ .event_address
171
+ color: #565656
172
+ font-size: 12px
173
+ .relative-container
174
  position: relative
175
  display: block
176
  height: 0
 
177
  overflow: hidden
178
+ .relative
179
  position: absolute
180
  top: 0
181
  left: 0
185
  border: 0
186
  margin: 0
187
  padding: 0
188
+ .video
189
+ padding: 0 0 56.25%
190
+ iframe, embed, object, video
191
+ @extend .relative
192
+ .fbpost-image
193
+ padding: 0 0 52.34%
194
+ div
195
+ cursor: pointer
196
+ background:
197
+ size: cover
198
+ position: 50% 50%
199
+ .cover
200
+ padding: 0 0 36.86%
201
+ div
202
+ background-size: 100% !important
203
+ background-position-x: 0
204
+ cursor: pointer
205
  .wef-video-link
206
  margin: 0 !important
207
  padding: 0 !important
templates/classic/com-page.php CHANGED
@@ -1,4 +1,4 @@
1
- <div class="wef-classic" style="max-width: <?php echo $width ?>px">
2
  <div class="row">
3
  <div class="col-3 text-center">
4
  <a href="https://www.facebook.com/<?php /** @noinspection PhpUndefinedVariableInspection */
@@ -13,7 +13,7 @@
13
  <br>
14
  <div>
15
  <?php
16
- $opt = get_option('wpemfb_show_like');
17
  if($opt === 'true') :
18
  echo WEF_Social_Plugins::like_btn('https://www.facebook.com/'.$fb_data['id'],array('share'=>'true','layout'=>'button_count'));
19
  else :
1
+ <div class="wef-classic aligncenter" style="max-width: <?php echo $width ?>px">
2
  <div class="row">
3
  <div class="col-3 text-center">
4
  <a href="https://www.facebook.com/<?php /** @noinspection PhpUndefinedVariableInspection */
13
  <br>
14
  <div>
15
  <?php
16
+ $opt = WP_Embed_FB_Plugin::get_option('show_like');
17
  if($opt === 'true') :
18
  echo WEF_Social_Plugins::like_btn('https://www.facebook.com/'.$fb_data['id'],array('share'=>'true','layout'=>'button_count'));
19
  else :
templates/classic/event.php CHANGED
@@ -1,21 +1,19 @@
1
  <?php
2
- /** @noinspection PhpUndefinedVariableInspection */
3
- $height = $width * $prop;
4
  $start_time_format = 'l, j F Y g:i a';
5
  $old_time_zone = date_default_timezone_get();
6
- if(get_option('wpemfb_ev_local_tz') == 'true'){
7
- $timezone = get_option( 'timezone_string' );
8
  } else {
9
- $timezone = isset( $fb_data['timezone'] ) ? $fb_data['timezone'] : get_option( 'timezone_string' );
10
  }
11
  date_default_timezone_set( $timezone );
12
  /** @noinspection PhpUndefinedVariableInspection */
13
  $start_time = date_i18n( $start_time_format, strtotime( $fb_data['start_time'] ) );
14
  date_default_timezone_set( $old_time_zone );
15
  ?>
16
- <div class="wef-classic wef-measure" style="max-width: <?php echo $width ?>px">
17
  <?php if(isset($fb_data['cover'])) : ?>
18
- <div class="cover" style="height:<?php echo $height ?>px; background: transparent url('<?php echo $fb_data['cover']['source'] ?>') no-repeat scroll 0 <?php echo $fb_data['cover']['offset_y'] ?>%;" onclick="window.open('https://www.facebook.com/<?php echo $fb_data['id'] ?>', '_blank')" ></div>
19
  <?php endif; ?>
20
  <div class="row pad-top">
21
  <div class="col-12">
@@ -36,4 +34,4 @@ date_default_timezone_set( $old_time_zone );
36
  <p><?php echo __( 'Creator: ', 'wp-embed-facebook' ) . '<a href="https://www.facebook.com/' . $fb_data['owner']['id'] . '" target="_blank">' . $fb_data['owner']['name'] . '</a>' ?></p>
37
  </div>
38
  </div>
39
- </div>
1
  <?php
 
 
2
  $start_time_format = 'l, j F Y g:i a';
3
  $old_time_zone = date_default_timezone_get();
4
+ if(WP_Embed_FB_Plugin::get_option('ev_local_tz') == 'true'){
5
+ $timezone = WP_Embed_FB_Plugin::get_timezone();
6
  } else {
7
+ $timezone = isset( $fb_data['timezone'] ) ? $fb_data['timezone'] : WP_Embed_FB_Plugin::get_timezone();
8
  }
9
  date_default_timezone_set( $timezone );
10
  /** @noinspection PhpUndefinedVariableInspection */
11
  $start_time = date_i18n( $start_time_format, strtotime( $fb_data['start_time'] ) );
12
  date_default_timezone_set( $old_time_zone );
13
  ?>
14
+ <div class="wef-classic aligncenter" style="max-width: <?php echo $width ?>px">
15
  <?php if(isset($fb_data['cover'])) : ?>
16
+ <div class="relative-container cover"><div class="relative" style="background-image: url('<?php echo $fb_data['cover']['source'] ?>'); background-position-y: <?php echo $fb_data['cover']['offset_y'] ?>%" onclick="window.open('https://www.facebook.com/<?php echo $fb_data['id'] ?>', '_blank')"></div></div>
17
  <?php endif; ?>
18
  <div class="row pad-top">
19
  <div class="col-12">
34
  <p><?php echo __( 'Creator: ', 'wp-embed-facebook' ) . '<a href="https://www.facebook.com/' . $fb_data['owner']['id'] . '" target="_blank">' . $fb_data['owner']['name'] . '</a>' ?></p>
35
  </div>
36
  </div>
37
+ </div>
templates/classic/page.php CHANGED
@@ -1,11 +1,7 @@
1
- <?php
2
- /** @noinspection PhpUndefinedVariableInspection */
3
- $height = round((($width - 21 ) * $prop),2);
4
- $show_posts = get_option("wpemfb_show_posts") == "true" ? true : false;
5
- ?>
6
- <div class="wef-classic wef-measure" style="max-width: <?php echo $width ?>px" >
7
- <div class="cover" style="height:<?php echo $height ?>px; background: transparent url('<?php /** @noinspection PhpUndefinedVariableInspection */
8
- echo $fb_data['cover']['source'] ?>') no-repeat scroll 0 <?php echo $fb_data['cover']['offset_y'] ?>%; " onclick="window.open('<?php echo $fb_data['link'] ?>', '_blank')" ></div>
9
  <div class="row pad-top">
10
  <div class="col-2 text-center">
11
  <a href="<?php echo $fb_data['link'] ?>" target="_blank" rel="nofollow">
@@ -31,7 +27,7 @@ $height = round((($width - 21 ) * $prop),2);
31
  <?php endif; ?>
32
  <div style="float: right;">
33
  <?php
34
- $opt = get_option('wpemfb_show_like');
35
  if($opt === 'true') :
36
  echo WEF_Social_Plugins::like_btn('https://www.facebook.com/'.$fb_data['id'],array('share'=>'true','layout'=>'button_count'));
37
  else :
@@ -41,7 +37,7 @@ $height = round((($width - 21 ) * $prop),2);
41
  </div>
42
  </div>
43
  </div>
44
- <?php if($show_posts && isset($fb_data['posts'])) : global $wp_embed; ?>
45
  <?php foreach($fb_data['posts']['data'] as $fb_post) : ?>
46
  <?php if(isset($fb_post['picture']) || isset($fb_post['message'])) : ?>
47
  <?php include('single-post.php') ?>
1
+ <div class="wef-classic aligncenter" style="max-width: <?php echo $width ?>px" >
2
+ <?php if(isset($fb_data['cover'])) : ?>
3
+ <div class="relative-container cover"><div class="relative" style="background-image: url('<?php echo $fb_data['cover']['source'] ?>'); background-position-y: <?php echo $fb_data['cover']['offset_y'] ?>%" onclick="window.open('https://www.facebook.com/<?php echo $fb_data['id'] ?>', '_blank')"></div></div>
4
+ <?php endif; ?>
 
 
 
 
5
  <div class="row pad-top">
6
  <div class="col-2 text-center">
7
  <a href="<?php echo $fb_data['link'] ?>" target="_blank" rel="nofollow">
27
  <?php endif; ?>
28
  <div style="float: right;">
29
  <?php
30
+ $opt = WP_Embed_FB_Plugin::get_option('show_like');
31
  if($opt === 'true') :
32
  echo WEF_Social_Plugins::like_btn('https://www.facebook.com/'.$fb_data['id'],array('share'=>'true','layout'=>'button_count'));
33
  else :
37
  </div>
38
  </div>
39
  </div>
40
+ <?php if(isset($fb_data['posts'])) : global $wp_embed; ?>
41
  <?php foreach($fb_data['posts']['data'] as $fb_post) : ?>
42
  <?php if(isset($fb_post['picture']) || isset($fb_post['message'])) : ?>
43
  <?php include('single-post.php') ?>
templates/classic/photo.php CHANGED
@@ -1,4 +1,4 @@
1
- <div class="wef-classic" style="max-width: <?php echo $width ?>px" >
2
  <a href="<?php /** @noinspection PhpUndefinedVariableInspection */
3
  echo $fb_data['link'] ?>" target="_blank" rel="nofollow">
4
  <img src="<?php echo $fb_data['source'] ?>" width="100%" height="auto" >
1
+ <div class="wef-classic aligncenter" style="max-width: <?php echo $width ?>px" >
2
  <a href="<?php /** @noinspection PhpUndefinedVariableInspection */
3
  echo $fb_data['link'] ?>" target="_blank" rel="nofollow">
4
  <img src="<?php echo $fb_data['source'] ?>" width="100%" height="auto" >
templates/classic/post.php CHANGED
@@ -1,6 +1,6 @@
1
  <?php $fb_post = /** @noinspection PhpUndefinedVariableInspection */
2
  $fb_data ?>
3
- <div class="wef-classic" style="max-width: <?php echo $width ?>px" >
4
  <div class="col-3 text-center">
5
  <a href="https://www.facebook.com/<?php echo $fb_post['from']['id'] ?>" target="_blank" rel="nofollow">
6
  <img src="https://graph.facebook.com/<?php echo $fb_post['from']['id'] ?>/picture" width="50px" height="50px" />
@@ -14,7 +14,7 @@
14
  </p>
15
  <div>
16
  <?php
17
- $opt = get_option('wpemfb_show_like');
18
  if($opt === 'true') :
19
  echo WEF_Social_Plugins::like_btn($fb_post['link'],array('share'=>'true','layout'=>'button_count'));
20
  else :
1
  <?php $fb_post = /** @noinspection PhpUndefinedVariableInspection */
2
  $fb_data ?>
3
+ <div class="wef-classic aligncenter" style="max-width: <?php echo $width ?>px" >
4
  <div class="col-3 text-center">
5
  <a href="https://www.facebook.com/<?php echo $fb_post['from']['id'] ?>" target="_blank" rel="nofollow">
6
  <img src="https://graph.facebook.com/<?php echo $fb_post['from']['id'] ?>/picture" width="50px" height="50px" />
14
  </p>
15
  <div>
16
  <?php
17
+ $opt = WP_Embed_FB_Plugin::get_option('show_like');
18
  if($opt === 'true') :
19
  echo WEF_Social_Plugins::like_btn($fb_post['link'],array('share'=>'true','layout'=>'button_count'));
20
  else :
templates/classic/profile.php CHANGED
@@ -1,4 +1,4 @@
1
- <div class="wef-classic" style="max-width: <?php echo $width ?>px">
2
  <div class="row">
3
  <div class="col-3 text-center">
4
  <a href="https://www.facebook.com/<?php /** @noinspection PhpUndefinedVariableInspection */
@@ -14,7 +14,7 @@
14
  </p>
15
  <div>
16
  <?php
17
- $opt = get_option('wpemfb_show_follow');
18
  if($opt === 'true') :
19
  WEF_Social_Plugins::follow_btn('https://www.facebook.com/'.$fb_data['id']);
20
  endif;
1
+ <div class="wef-classic aligncenter" style="max-width: <?php echo $width ?>px">
2
  <div class="row">
3
  <div class="col-3 text-center">
4
  <a href="https://www.facebook.com/<?php /** @noinspection PhpUndefinedVariableInspection */
14
  </p>
15
  <div>
16
  <?php
17
+ $opt = WP_Embed_FB_Plugin::get_option('show_follow');
18
  if($opt === 'true') :
19
  WEF_Social_Plugins::follow_btn('https://www.facebook.com/'.$fb_data['id']);
20
  endif;
templates/classic/single-post.php CHANGED
@@ -7,18 +7,18 @@ $description = isset($fb_post['description']) && !empty($fb_post['description'])
7
  $caption = isset($fb_post['caption']) && !empty($fb_post['caption']) ? $fb_post['caption'] : null ;
8
  $name = isset($fb_post['name']) && !empty($fb_post['name']) ? $fb_post['name'] : null ;
9
  $is_fb_link = strpos($fb_post['link'],'facebook.com') !== false;
10
- $video_ratio = (get_option('wpemfb_video_ratio') == 'true') ? true : false;
11
  if(isset($fb_post['message']) && !empty($fb_post['message'])) :
12
  $message = str_replace($fb_post['link'],'',$fb_post['message']);
13
  $message = WP_Embed_FB::make_clickable($message);
14
  endif;
15
- $name = $name ? '<p class="caption-title">'.$name.'</p>':'';
16
  $description = $description ? '<div class="caption-description">'.$description.'</div>':'';
17
  $caption = $caption ? '<p class="caption-link"><a href="'.$fb_post["link"].'" rel="nofollow">'.$caption.'</a></p>':'';
18
  $link_info = $name.$description.$caption;
19
  $icon = isset($fb_post["icon"]) ? '<img class="icon" src="'.$fb_post["icon"].'">' : '';
20
  $old_time_zone = date_default_timezone_get();
21
- date_default_timezone_set(get_option('timezone_string'));
22
  $post_time = $icon.date_i18n('l, j F Y g:s a', strtotime($fb_post['created_time'])) ;
23
  date_default_timezone_set($old_time_zone);
24
  ?>
@@ -42,7 +42,7 @@ date_default_timezone_set($old_time_zone);
42
  WP_Embed_FB::$width = $width_r;
43
  echo $link_info;
44
  } else {
45
- $use_ratio = (get_option('wpemfb_video_ratio') == 'true');
46
  echo '<div class="post-link">';
47
  echo $use_ratio ? '<div class="video">' : '';
48
  echo $wp_embed->shortcode(array('src'=>$fb_post['link'], 'width'=>$width - 20));
@@ -68,9 +68,11 @@ date_default_timezone_set($old_time_zone);
68
  case 'link':
69
  ?>
70
  <div class="post-link" style="max-width: <?php echo $width?>px;">
71
- <a href="<?php echo $fb_post['link'] ?>" rel="nofollow" target="_blank">
72
- <img src="<?php echo $fb_post['full_picture'] ?>" width="100%" height="auto" /><br>
73
- </a>
 
 
74
  <?php if($fb_post["type"] == 'music') : ?>
75
  <p>
76
  <audio controls>
@@ -94,7 +96,7 @@ date_default_timezone_set($old_time_zone);
94
  <?php
95
  break;
96
  endswitch;
97
- ?>
98
  <a class="post-likes" href="<?php echo "https://www.facebook.com/".$link[0]."/posts/".$link[1] ?> " target="_blank" rel="nofollow">
99
  <?php echo isset($fb_post['likes']) ? '<img src="https://fbstatic-a.akamaihd.net/rsrc.php/v2/y6/r/l9Fe9Ugss0S.gif" />'.$fb_post['likes']['summary']['total_count'].' ' : "" ?>
100
  <?php echo isset($fb_post['comments']) ? '<img src="https://fbstatic-a.akamaihd.net/rsrc.php/v2/yg/r/V8Yrm0eKZpi.gif" />'.$fb_post['comments']['summary']['total_count'].' ' : "" ?>
7
  $caption = isset($fb_post['caption']) && !empty($fb_post['caption']) ? $fb_post['caption'] : null ;
8
  $name = isset($fb_post['name']) && !empty($fb_post['name']) ? $fb_post['name'] : null ;
9
  $is_fb_link = strpos($fb_post['link'],'facebook.com') !== false;
10
+ $video_ratio = (WP_Embed_FB_Plugin::get_option('video_ratio') == 'true') ? true : false;
11
  if(isset($fb_post['message']) && !empty($fb_post['message'])) :
12
  $message = str_replace($fb_post['link'],'',$fb_post['message']);
13
  $message = WP_Embed_FB::make_clickable($message);
14
  endif;
15
+ $name = $name ? '<p class="caption-title"><a href="'.$name.'" title="'.$name.'" target="_blank" rel="nofollow">'.$name.'</a></p>':'';
16
  $description = $description ? '<div class="caption-description">'.$description.'</div>':'';
17
  $caption = $caption ? '<p class="caption-link"><a href="'.$fb_post["link"].'" rel="nofollow">'.$caption.'</a></p>':'';
18
  $link_info = $name.$description.$caption;
19
  $icon = isset($fb_post["icon"]) ? '<img class="icon" src="'.$fb_post["icon"].'">' : '';
20
  $old_time_zone = date_default_timezone_get();
21
+ date_default_timezone_set(WP_Embed_FB_Plugin::get_timezone());
22
  $post_time = $icon.date_i18n('l, j F Y g:s a', strtotime($fb_post['created_time'])) ;
23
  date_default_timezone_set($old_time_zone);
24
  ?>
42
  WP_Embed_FB::$width = $width_r;
43
  echo $link_info;
44
  } else {
45
+ $use_ratio = (WP_Embed_FB_Plugin::get_option('video_ratio') == 'true');
46
  echo '<div class="post-link">';
47
  echo $use_ratio ? '<div class="video">' : '';
48
  echo $wp_embed->shortcode(array('src'=>$fb_post['link'], 'width'=>$width - 20));
68
  case 'link':
69
  ?>
70
  <div class="post-link" style="max-width: <?php echo $width?>px;">
71
+ <?php if(isset($fb_post['full_picture']) && !empty($fb_post['full_picture'])) : ?>
72
+ <div class="relative-container fbpost-image">
73
+ <div class="relative" style="background-image: url('<?php echo $fb_post['full_picture'] ?>');" onclick="window.open('<?php echo $fb_post['link'] ?>', '_blank')"></div>
74
+ </div>
75
+ <?php endif ?>
76
  <?php if($fb_post["type"] == 'music') : ?>
77
  <p>
78
  <audio controls>
96
  <?php
97
  break;
98
  endswitch;
99
+ ?><br>
100
  <a class="post-likes" href="<?php echo "https://www.facebook.com/".$link[0]."/posts/".$link[1] ?> " target="_blank" rel="nofollow">
101
  <?php echo isset($fb_post['likes']) ? '<img src="https://fbstatic-a.akamaihd.net/rsrc.php/v2/y6/r/l9Fe9Ugss0S.gif" />'.$fb_post['likes']['summary']['total_count'].' ' : "" ?>
102
  <?php echo isset($fb_post['comments']) ? '<img src="https://fbstatic-a.akamaihd.net/rsrc.php/v2/yg/r/V8Yrm0eKZpi.gif" />'.$fb_post['comments']['summary']['total_count'].' ' : "" ?>
templates/classic/social-plugin.php CHANGED
@@ -6,7 +6,7 @@ switch($type){
6
  echo WEF_Social_Plugins::page_plugin('https://www.facebook.com/'.$fb_data['link'],$width);
7
  break;
8
  case 'video' :
9
- if(get_option('wpemfb_video_as_post','false') == 'true')
10
  /** @noinspection PhpUndefinedVariableInspection */
11
  echo WEF_Social_Plugins::embedded_post('https://www.facebook.com/'.$fb_data['link'],$width);
12
  else
6
  echo WEF_Social_Plugins::page_plugin('https://www.facebook.com/'.$fb_data['link'],$width);
7
  break;
8
  case 'video' :
9
+ if(WP_Embed_FB_Plugin::get_option('video_as_post') == 'true')
10
  /** @noinspection PhpUndefinedVariableInspection */
11
  echo WEF_Social_Plugins::embedded_post('https://www.facebook.com/'.$fb_data['link'],$width);
12
  else
templates/classic/video.php CHANGED
@@ -1,8 +1,8 @@
1
  <?php
2
- $use_ratio = (get_option('wpemfb_video_ratio') == 'true');
3
  ?>
4
- <div class="wef-classic" style="max-width: <?php echo $width ?>px">
5
- <?php echo $use_ratio ? '<div class="video">' : '' ?>
6
  <?php
7
  /** @noinspection PhpUndefinedVariableInspection */
8
  $url = $fb_data['source'];
1
  <?php
2
+ $use_ratio = (WP_Embed_FB_Plugin::get_option('video_ratio') == 'true');
3
  ?>
4
+ <div class="wef-classic aligncenter" style="max-width: <?php echo $width ?>px">
5
+ <?php echo $use_ratio ? '<div class="relative-container video">' : '' ?>
6
  <?php
7
  /** @noinspection PhpUndefinedVariableInspection */
8
  $url = $fb_data['source'];
templates/default/album.php CHANGED
@@ -19,17 +19,18 @@
19
  </div>
20
  <hr>
21
  <div class="row">
22
- <div class="col-12">
23
  <div class="text-center album-thumbs">
24
  <?php
25
- foreach ($fb_data['photos']['data'] as $pic) {
26
- $data_title = isset($pic['name']) ? $pic['name'] : $fb_data['from']['name'];
27
- ?>
28
- <a href="<?php echo $pic['source'] ?>" data-lightbox="roadtrip" data-title="<?php echo esc_attr(wp_rel_nofollow(make_clickable($data_title))) ?>" >
29
- <img class="thumbnail" src="<?php echo $pic['picture'] ?>" />
30
- </a>
31
- <?php
32
- }
 
33
  ?>
34
  </div>
35
  </div>
19
  </div>
20
  <hr>
21
  <div class="row">
22
+ <div class="col-12 text-center">
23
  <div class="text-center album-thumbs">
24
  <?php
25
+ if(isset($fb_data['photos']))
26
+ foreach ($fb_data['photos']['data'] as $pic) {
27
+ $data_title = isset($pic['name']) ? $pic['name'] : '';
28
+ ?>
29
+ <a href="<?php echo $pic['source'] ?>" data-lightbox="roadtrip" <?php echo !empty($data_title) ? 'data-title="'.esc_attr(wp_rel_nofollow(make_clickable(str_replace(array('"',"'"),array('&#34;','&#39;'),$data_title)))).'"' : '' ?> >
30
+ <img class="thumbnail" src="<?php echo $pic['picture'] ?>" />
31
+ </a>
32
+ <?php
33
+ }
34
  ?>
35
  </div>
36
  </div>
templates/default/com-page.php CHANGED
@@ -13,7 +13,7 @@
13
  <br>
14
  <div>
15
  <?php
16
- $opt = get_option('wpemfb_show_like');
17
  if($opt === 'true') :
18
  echo WEF_Social_Plugins::like_btn('https://www.facebook.com/'.$fb_data['id'],array('share'=>'true','layout'=>'button_count'));
19
  else :
13
  <br>
14
  <div>
15
  <?php
16
+ $opt = WP_Embed_FB_Plugin::get_option('show_like');
17
  if($opt === 'true') :
18
  echo WEF_Social_Plugins::like_btn('https://www.facebook.com/'.$fb_data['id'],array('share'=>'true','layout'=>'button_count'));
19
  else :
templates/default/default.css CHANGED
@@ -1,192 +1 @@
1
- .wef-default {
2
- font: 300 14px/20px Helvetica;
3
- padding: 10px;
4
- display: inline-block;
5
- border-width: 1px;
6
- border-style: solid;
7
- border-color: #dedede;
8
- border-radius: 2px;
9
- width: 100%;
10
- background-color: white; }
11
- .wef-default .row {
12
- margin-left: -10px;
13
- margin-right: -10px;
14
- display: table;
15
- width: 100%; }
16
- .wef-default .col-1, .wef-default .col-2, .wef-default .col-3, .wef-default .col-4, .wef-default .col-5, .wef-default .col-6, .wef-default .col-7, .wef-default .col-8, .wef-default .col-9, .wef-default .col-10, .wef-default .col-11, .wef-default .col-12 {
17
- /* float: left */
18
- position: relative;
19
- min-height: 1px;
20
- padding-left: 10px;
21
- padding-right: 10px;
22
- display: table-cell;
23
- vertical-align: middle;
24
- text-align: left; }
25
- .wef-default .col-12 {
26
- width: 100%; }
27
- .wef-default .col-11 {
28
- width: 91.66667%; }
29
- .wef-default .col-10 {
30
- width: 83.33333%; }
31
- .wef-default .col-9 {
32
- width: 75%; }
33
- .wef-default .col-8 {
34
- width: 66.66667%; }
35
- .wef-default .col-7 {
36
- width: 58.33333%; }
37
- .wef-default .col-6 {
38
- width: 50%; }
39
- .wef-default .col-5 {
40
- width: 41.66667%; }
41
- .wef-default .col-4 {
42
- width: 33.33333%; }
43
- .wef-default .col-3 {
44
- width: 25%; }
45
- .wef-default .col-2 {
46
- width: 16.66667%; }
47
- .wef-default .col-1 {
48
- width: 8.33333%; }
49
- .wef-default hr {
50
- margin-top: 10px !important;
51
- margin-bottom: 10px !important;
52
- margin-left: 0 !important;
53
- margin-right: 0 !important;
54
- float: none !important;
55
- border-top: 1px;
56
- border-style: solid;
57
- border-color: #dedede;
58
- -moz-box-sizing: content-box;
59
- -webkit-box-sizing: content-box;
60
- box-sizing: content-box;
61
- height: 0 !important;
62
- width: 100% !important; }
63
- .wef-default img.icon {
64
- float: right;
65
- box-shadow: none;
66
- margin: 0;
67
- padding: 0;
68
- display: block; }
69
- .wef-default img.thumbnail {
70
- border: 1px solid gray;
71
- border-radius: 2px;
72
- height: 60px !important;
73
- margin: 1px;
74
- padding: 2px;
75
- width: 60px !important; }
76
- .wef-default .album-thumbs {
77
- line-height: 1px !important; }
78
- .wef-default a {
79
- font: 300 14px/20px Helvetica;
80
- color: #23487f !important;
81
- text-decoration: none !important;
82
- border: 0 !important;
83
- margin: 0 !important;
84
- padding: 0 !important;
85
- box-shadow: none !important; }
86
- .wef-default a:focus, .wef-default a:hover {
87
- color: #23487f;
88
- text-decoration: underline !important; }
89
- .wef-default a.post-likes {
90
- color: #6d84b4 !important;
91
- font-size: 12px !important; }
92
- .wef-default a.road-trip {
93
- width: 0 !important;
94
- height: 0 !important; }
95
- .wef-default a img {
96
- display: inline-block !important;
97
- margin: 0;
98
- padding: 0; }
99
- .wef-default p {
100
- font: 300 14px/20px Helvetica;
101
- padding: 0 !important;
102
- margin: 0 !important; }
103
- .wef-default p.post-time {
104
- font-style: italic;
105
- color: #8e8c8d;
106
- font-size: 12px; }
107
- .wef-default p.caption-title {
108
- font-size: 12px;
109
- font-weight: bold; }
110
- .wef-default p.caption-link {
111
- text-align: right;
112
- word-break: break-all; }
113
- .wef-default p.caption-link a {
114
- font-size: 12px;
115
- color: #8e8c8d !important;
116
- text-transform: uppercase; }
117
- .wef-default iframe, .wef-default embed, .wef-default object, .wef-default video, .wef-default audio {
118
- width: 100% !important;
119
- border: 0 !important;
120
- margin: 0 !important;
121
- padding: 0 !important; }
122
- .wef-default .post-link {
123
- border-width: 1px;
124
- border-style: solid;
125
- border-color: #d0d0d0; }
126
- .wef-default .post-link p {
127
- padding-left: 10px !important;
128
- padding-right: 10px !important; }
129
- .wef-default .text-center {
130
- text-align: center; }
131
- .wef-default .pl-none {
132
- padding-left: 0 !important;
133
- word-break: break-all; }
134
- .wef-default .color {
135
- color: #23487f; }
136
- .wef-default .bold {
137
- font-weight: bold !important; }
138
- .wef-default .title {
139
- font-size: 20px !important;
140
- font-weight: bold !important;
141
- word-break: break-all;
142
- display: inherit !important;
143
- height: 100% !important;
144
- background-color: transparent !important;
145
- padding-top: 5px !important; }
146
- .wef-default .cover {
147
- width: 100%;
148
- background-size: 100% !important;
149
- cursor: pointer; }
150
- .wef-default .pad-top {
151
- padding-top: 5px; }
152
- .wef-default .page-post {
153
- left: 2.6% !important; }
154
- .wef-default .caption-description p {
155
- color: #8e8c8d !important;
156
- font-style: italic !important;
157
- font-size: 12px !important; }
158
- .wef-default .video {
159
- position: relative;
160
- display: block;
161
- height: 0;
162
- padding: 0 0 56.25%;
163
- overflow: hidden; }
164
- .wef-default .video iframe, .wef-default .video embed, .wef-default .video object, .wef-default .video video {
165
- position: absolute;
166
- top: 0;
167
- left: 0;
168
- bottom: 0;
169
- height: 100%;
170
- width: 100%;
171
- border: 0;
172
- margin: 0;
173
- padding: 0; }
174
- .wef-default .wef-measure {
175
- width: 100%; }
176
- .wef-default .break-all {
177
- word-break: break-all; }
178
- .wef-default .event_address {
179
- color: #565656;
180
- font-size: 12px; }
181
-
182
- .wef-video-link {
183
- margin: 0 !important;
184
- padding: 0 !important; }
185
- .wef-video-link a {
186
- font: 300 14px/20px Helvetica;
187
- color: #23487f !important;
188
- text-decoration: none !important;
189
- border: 0 !important;
190
- margin: 0 !important;
191
- padding: 0 !important;
192
- box-shadow: none !important; }
1
+ .wef-default{font:300 14px/20px Helvetica;padding:10px;display:inline-block;border-width:1px;border-style:solid;border-color:#dedede;border-radius:2px;width:100%;background-color:#fff}.wef-default .row{margin-left:-10px;margin-right:-10px;display:table;width:100%}.wef-default .col-1,.wef-default .col-2,.wef-default .col-3,.wef-default .col-4,.wef-default .col-5,.wef-default .col-6,.wef-default .col-7,.wef-default .col-8,.wef-default .col-9,.wef-default .col-10,.wef-default .col-11,.wef-default .col-12{position:relative;min-height:1px;padding-left:10px;padding-right:10px;display:table-cell;vertical-align:middle;text-align:left}.wef-default .col-12{width:100%}.wef-default .col-11{width:91.66667%}.wef-default .col-10{width:83.33333%}.wef-default .col-9{width:75%}.wef-default .col-8{width:66.66667%}.wef-default .col-7{width:58.33333%}.wef-default .col-6{width:50%}.wef-default .col-5{width:41.66667%}.wef-default .col-4{width:33.33333%}.wef-default .col-3{width:25%}.wef-default .col-2{width:16.66667%}.wef-default .col-1{width:8.33333%}.wef-default hr{margin-top:10px !important;margin-bottom:10px !important;margin-left:0 !important;margin-right:0 !important;float:none !important;border-top:1px;border-style:solid;border-color:#dedede;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;box-sizing:content-box;height:0 !important;width:100% !important}.wef-default img.icon{float:right;box-shadow:none;margin:0;padding:0;display:block}.wef-default img.thumbnail{border:1px solid gray;border-radius:2px;height:60px !important;margin:1px;padding:2px;width:60px !important}.wef-default .album-thumbs{line-height:1px !important}.wef-default a{font:300 14px/20px Helvetica;color:#23487f !important;text-decoration:none !important;border:0 !important;margin:0 !important;padding:0 !important;box-shadow:none !important}.wef-default a:focus,.wef-default a:hover{color:#23487f;text-decoration:underline !important}.wef-default a.post-likes{color:#6d84b4 !important;font-size:12px !important}.wef-default a.road-trip{width:0 !important;height:0 !important}.wef-default a img{display:inline-block !important;margin:0;padding:0}.wef-default p{font:300 14px/20px Helvetica;padding:0 !important;margin:0 !important}.wef-default p.post-time{font-style:italic;color:#8e8c8d;font-size:12px}.wef-default p.caption-link{text-align:right;word-break:break-all}.wef-default p.caption-link a{font-size:12px;color:#8e8c8d !important;text-transform:uppercase}.wef-default p.caption-title{text-align:left}.wef-default p.caption-title a{font-size:12px;font-weight:bold}.wef-default iframe,.wef-default embed,.wef-default object,.wef-default video,.wef-default audio{width:100% !important;border:0 !important;margin:0 !important;padding:0 !important}.wef-default .post-link{border-width:1px;border-style:solid;border-color:#d0d0d0;box-shadow:1px 1px 2px #b3b3b3}.wef-default .post-link p{padding-left:10px !important;padding-right:10px !important}.wef-default .text-center{text-align:center}.wef-default .pl-none{padding-left:0 !important;word-break:break-all}.wef-default .color{color:#23487f}.wef-default .bold{font-weight:bold !important}.wef-default .title{font-size:20px !important;font-weight:bold !important;word-break:break-all;display:inherit !important;height:100% !important;background-color:transparent !important;padding-top:5px !important}.wef-default .pad-top{padding-top:5px}.wef-default .page-post{left:2.6% !important}.wef-default .caption-description p{color:#8e8c8d !important;font-style:italic !important;font-size:12px !important}.wef-default .wef-measure{width:100%}.wef-default .break-all{word-break:break-all}.wef-default .event_address{color:#565656;font-size:12px}.wef-default .relative-container{position:relative;display:block;height:0;overflow:hidden}.wef-default .relative-container .relative,.wef-default .relative-container .video iframe,.wef-default .video .relative-container iframe,.wef-default .relative-container .video embed,.wef-default .video .relative-container embed,.wef-default .relative-container .video object,.wef-default .video .relative-container object,.wef-default .relative-container .video video,.wef-default .video .relative-container video{position:absolute;top:0;left:0;bottom:0;height:100%;width:100%;border:0;margin:0;padding:0}.wef-default .video{padding:0 0 56.25%}.wef-default .fbpost-image{padding:0 0 52.34%}.wef-default .fbpost-image div{cursor:pointer;background-size:cover;background-position:50% 50%}.wef-default .cover{padding:0 0 36.86%}.wef-default .cover div{background-size:100% !important;background-position-x:0;cursor:pointer}.wef-video-link{margin:0 !important;padding:0 !important}.wef-video-link a{font:300 14px/20px Helvetica;color:#23487f !important;text-decoration:none !important;border:0 !important;margin:0 !important;padding:0 !important;box-shadow:none !important}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
templates/default/default.sass CHANGED
@@ -110,9 +110,6 @@
110
  font-style: italic
111
  color: #8e8c8d
112
  font-size: 12px
113
- &.caption-title
114
- font-size: 12px
115
- font-weight: bold
116
  &.caption-link
117
  text-align: right
118
  word-break: break-all
@@ -120,6 +117,11 @@
120
  font-size: 12px
121
  color: #8e8c8d !important
122
  text-transform: uppercase
 
 
 
 
 
123
  iframe, embed, object, video, audio
124
  width: 100% !important
125
  border: 0 !important
@@ -130,6 +132,7 @@
130
  width: 1px
131
  style: solid
132
  color: #d0d0d0
 
133
  p
134
  padding:
135
  left: 10px !important
@@ -151,10 +154,6 @@
151
  height: 100% !important
152
  background-color: transparent !important
153
  padding-top: 5px !important
154
- .cover
155
- width: 100%
156
- background-size: 100% !important
157
- cursor: pointer
158
  .pad-top
159
  padding:
160
  top: 5px
@@ -164,13 +163,19 @@
164
  color: #8e8c8d !important
165
  font-style: italic !important
166
  font-size: 12px !important
167
- .video
 
 
 
 
 
 
 
168
  position: relative
169
  display: block
170
  height: 0
171
- padding: 0 0 56.25%
172
  overflow: hidden
173
- iframe, embed, object, video
174
  position: absolute
175
  top: 0
176
  left: 0
@@ -180,13 +185,23 @@
180
  border: 0
181
  margin: 0
182
  padding: 0
183
- .wef-measure
184
- width: 100%
185
- .break-all
186
- word-break: break-all
187
- .event_address
188
- color: #565656
189
- font-size: 12px
 
 
 
 
 
 
 
 
 
 
190
  .wef-video-link
191
  margin: 0 !important
192
  padding: 0 !important
@@ -197,4 +212,4 @@
197
  border: 0 !important
198
  margin: 0 !important
199
  padding: 0 !important
200
- box-shadow: none !important
110
  font-style: italic
111
  color: #8e8c8d
112
  font-size: 12px
 
 
 
113
  &.caption-link
114
  text-align: right
115
  word-break: break-all
117
  font-size: 12px
118
  color: #8e8c8d !important
119
  text-transform: uppercase
120
+ &.caption-title
121
+ text-align: left
122
+ a
123
+ font-size: 12px
124
+ font-weight: bold
125
  iframe, embed, object, video, audio
126
  width: 100% !important
127
  border: 0 !important
132
  width: 1px
133
  style: solid
134
  color: #d0d0d0
135
+ box-shadow: 1px 1px 2px #b3b3b3
136
  p
137
  padding:
138
  left: 10px !important
154
  height: 100% !important
155
  background-color: transparent !important
156
  padding-top: 5px !important
 
 
 
 
157
  .pad-top
158
  padding:
159
  top: 5px
163
  color: #8e8c8d !important
164
  font-style: italic !important
165
  font-size: 12px !important
166
+ .wef-measure
167
+ width: 100%
168
+ .break-all
169
+ word-break: break-all
170
+ .event_address
171
+ color: #565656
172
+ font-size: 12px
173
+ .relative-container
174
  position: relative
175
  display: block
176
  height: 0
 
177
  overflow: hidden
178
+ .relative
179
  position: absolute
180
  top: 0
181
  left: 0
185
  border: 0
186
  margin: 0
187
  padding: 0
188
+ .video
189
+ padding: 0 0 56.25%
190
+ iframe, embed, object, video
191
+ @extend .relative
192
+ .fbpost-image
193
+ padding: 0 0 52.34%
194
+ div
195
+ cursor: pointer
196
+ background:
197
+ size: cover
198
+ position: 50% 50%
199
+ .cover
200
+ padding: 0 0 36.86%
201
+ div
202
+ background-size: 100% !important
203
+ background-position-x: 0
204
+ cursor: pointer
205
  .wef-video-link
206
  margin: 0 !important
207
  padding: 0 !important
212
  border: 0 !important
213
  margin: 0 !important
214
  padding: 0 !important
215
+ box-shadow: none !important
templates/default/event.php CHANGED
@@ -1,21 +1,19 @@
1
  <?php
2
- /** @noinspection PhpUndefinedVariableInspection */
3
- $height = $width * $prop;
4
  $start_time_format = 'l, j F Y g:i a';
5
  $old_time_zone = date_default_timezone_get();
6
- if(get_option('wpemfb_ev_local_tz') == 'true'){
7
- $timezone = get_option( 'timezone_string' );
8
  } else {
9
- $timezone = isset( $fb_data['timezone'] ) ? $fb_data['timezone'] : get_option( 'timezone_string' );
10
  }
11
  date_default_timezone_set( $timezone );
12
  /** @noinspection PhpUndefinedVariableInspection */
13
  $start_time = date_i18n( $start_time_format, strtotime( $fb_data['start_time'] ) );
14
  date_default_timezone_set( $old_time_zone );
15
  ?>
16
- <div class="wef-default wef-measure" style="max-width: <?php echo $width ?>px">
17
  <?php if(isset($fb_data['cover'])) : ?>
18
- <div class="cover" style="height:<?php echo $height ?>px; background: transparent url('<?php echo $fb_data['cover']['source'] ?>') no-repeat scroll 0 <?php echo $fb_data['cover']['offset_y'] ?>%; " onclick="window.open('https://www.facebook.com/<?php echo $fb_data['id'] ?>', '_blank')" ></div>
19
  <?php endif; ?>
20
  <div class="row pad-top">
21
  <div class="col-12">
1
  <?php
 
 
2
  $start_time_format = 'l, j F Y g:i a';
3
  $old_time_zone = date_default_timezone_get();
4
+ if(WP_Embed_FB_Plugin::get_option('ev_local_tz') == 'true'){
5
+ $timezone = WP_Embed_FB_Plugin::get_timezone();
6
  } else {
7
+ $timezone = isset( $fb_data['timezone'] ) ? $fb_data['timezone'] : WP_Embed_FB_Plugin::get_timezone();
8
  }
9
  date_default_timezone_set( $timezone );
10
  /** @noinspection PhpUndefinedVariableInspection */
11
  $start_time = date_i18n( $start_time_format, strtotime( $fb_data['start_time'] ) );
12
  date_default_timezone_set( $old_time_zone );
13
  ?>
14
+ <div class="wef-default" style="max-width: <?php echo $width ?>px">
15
  <?php if(isset($fb_data['cover'])) : ?>
16
+ <div class="relative-container cover"><div class="relative" style="background-image: url('<?php echo $fb_data['cover']['source'] ?>'); background-position-y: <?php echo $fb_data['cover']['offset_y'] ?>%" onclick="window.open('https://www.facebook.com/<?php echo $fb_data['id'] ?>', '_blank')"></div></div>
17
  <?php endif; ?>
18
  <div class="row pad-top">
19
  <div class="col-12">
templates/default/page.php CHANGED
@@ -1,11 +1,6 @@
1
- <?php
2
- /** @noinspection PhpUndefinedVariableInspection */
3
- $height = round((($width - 21 ) * $prop),2);
4
- $show_posts = get_option("wpemfb_show_posts") == "true" ? true : false;
5
- ?>
6
- <div class="wef-default wef-measure" style="max-width: <?php echo $width ?>px" >
7
  <?php if(isset($fb_data['cover'])) : ?>
8
- <div class="cover" style="height:<?php echo $height ?>px; background: transparent url('<?php echo $fb_data['cover']['source'] ?>') no-repeat scroll 0 <?php echo $fb_data['cover']['offset_y'] ?>%;" onclick="window.open('<?php echo $fb_data['link'] ?>', '_blank')" ></div>
9
  <?php endif; ?>
10
  <div class="row pad-top">
11
  <div class="col-2 text-center">
@@ -32,7 +27,7 @@ $height = round((($width - 21 ) * $prop),2);
32
  <?php endif; ?>
33
  <div style="float: right;">
34
  <?php
35
- $opt = get_option('wpemfb_show_like');
36
  if($opt === 'true') :
37
  echo WEF_Social_Plugins::like_btn('https://www.facebook.com/'.$fb_data['id'],array('share'=>'true','layout'=>'button_count'));
38
  else :
@@ -42,7 +37,7 @@ $height = round((($width - 21 ) * $prop),2);
42
  </div>
43
  </div>
44
  </div>
45
- <?php if($show_posts && isset($fb_data['posts'])) : global $wp_embed; ?>
46
  <?php foreach($fb_data['posts']['data'] as $fb_post) : ?>
47
  <?php if(isset($fb_post['picture']) || isset($fb_post['message'])) : ?>
48
  <?php include('single-post.php') ?>
1
+ <div class="wef-default" style="max-width: <?php echo $width ?>px" >
 
 
 
 
 
2
  <?php if(isset($fb_data['cover'])) : ?>
3
+ <div class="relative-container cover"><div class="relative" style="background-image: url('<?php echo $fb_data['cover']['source'] ?>'); background-position-y: <?php echo $fb_data['cover']['offset_y'] ?>%" onclick="window.open('https://www.facebook.com/<?php echo $fb_data['id'] ?>', '_blank')"></div></div>
4
  <?php endif; ?>
5
  <div class="row pad-top">
6
  <div class="col-2 text-center">
27
  <?php endif; ?>
28
  <div style="float: right;">
29
  <?php
30
+ $opt = WP_Embed_FB_Plugin::get_option('show_like');
31
  if($opt === 'true') :
32
  echo WEF_Social_Plugins::like_btn('https://www.facebook.com/'.$fb_data['id'],array('share'=>'true','layout'=>'button_count'));
33
  else :
37
  </div>
38
  </div>
39
  </div>
40
+ <?php if(isset($fb_data['posts'])) : global $wp_embed; ?>
41
  <?php foreach($fb_data['posts']['data'] as $fb_post) : ?>
42
  <?php if(isset($fb_post['picture']) || isset($fb_post['message'])) : ?>
43
  <?php include('single-post.php') ?>
templates/default/post.php CHANGED
@@ -14,7 +14,7 @@
14
  </p>
15
  <div>
16
  <?php
17
- $opt = get_option('wpemfb_show_like');
18
  if($opt === 'true') :
19
  echo WEF_Social_Plugins::like_btn($fb_post['link'],array('share'=>'true','layout'=>'button_count'));
20
  else :
14
  </p>
15
  <div>
16
  <?php
17
+ $opt = WP_Embed_FB_Plugin::get_option('show_like');
18
  if($opt === 'true') :
19
  echo WEF_Social_Plugins::like_btn($fb_post['link'],array('share'=>'true','layout'=>'button_count'));
20
  else :
templates/default/profile.php CHANGED
@@ -14,7 +14,7 @@
14
  </p>
15
  <div>
16
  <?php
17
- $opt = get_option('wpemfb_show_follow');
18
  if($opt === 'true') :
19
  WEF_Social_Plugins::follow_btn('https://www.facebook.com/'.$fb_data['id']);
20
  endif;
14
  </p>
15
  <div>
16
  <?php
17
+ $opt = WP_Embed_FB_Plugin::get_option('show_follow');
18
  if($opt === 'true') :
19
  WEF_Social_Plugins::follow_btn('https://www.facebook.com/'.$fb_data['id']);
20
  endif;
templates/default/single-post.php CHANGED
@@ -7,18 +7,18 @@ $description = isset($fb_post['description']) && !empty($fb_post['description'])
7
  $caption = isset($fb_post['caption']) && !empty($fb_post['caption']) ? $fb_post['caption'] : null ;
8
  $name = isset($fb_post['name']) && !empty($fb_post['name']) ? $fb_post['name'] : null ;
9
  $is_fb_link = strpos($fb_post['link'],'facebook.com') !== false;
10
- $video_ratio = (get_option('wpemfb_video_ratio') == 'true') ? true : false;
11
  if(isset($fb_post['message']) && !empty($fb_post['message'])) :
12
  $message = str_replace($fb_post['link'],'',$fb_post['message']);
13
  $message = WP_Embed_FB::make_clickable($message);
14
  endif;
15
- $name = $name ? '<p class="caption-title">'.$name.'</p>':'';
16
  $description = $description ? '<div class="caption-description">'.$description.'</div>':'';
17
  $caption = $caption ? '<p class="caption-link"><a href="'.$fb_post["link"].'" rel="nofollow">'.$caption.'</a></p>':'';
18
  $link_info = $name.$description.$caption;
19
  $icon = isset($fb_post["icon"]) ? '<img class="icon" src="'.$fb_post["icon"].'">' : '';
20
  $old_time_zone = date_default_timezone_get();
21
- date_default_timezone_set(get_option('timezone_string'));
22
  $post_time = $icon.date_i18n('l, j F Y g:s a', strtotime($fb_post['created_time'])) ;
23
  date_default_timezone_set($old_time_zone);
24
  ?>
@@ -42,7 +42,7 @@ date_default_timezone_set($old_time_zone);
42
  WP_Embed_FB::$width = $width_r;
43
  echo $link_info;
44
  } else {
45
- $use_ratio = (get_option('wpemfb_video_ratio') == 'true');
46
  echo '<div class="post-link">';
47
  echo $use_ratio ? '<div class="video">' : '';
48
  echo $wp_embed->shortcode(array('src'=>$fb_post['link'], 'width'=>$width - 20));
@@ -68,9 +68,11 @@ date_default_timezone_set($old_time_zone);
68
  case 'link':
69
  ?>
70
  <div class="post-link" style="max-width: <?php echo $width?>px;">
71
- <a href="<?php echo $fb_post['link'] ?>" rel="nofollow" target="_blank">
72
- <img src="<?php echo $fb_post['full_picture'] ?>" width="100%" height="auto" /><br>
73
- </a>
 
 
74
  <?php if($fb_post["type"] == 'music') : ?>
75
  <p>
76
  <audio controls>
@@ -85,7 +87,7 @@ date_default_timezone_set($old_time_zone);
85
  case 'status':
86
  default:
87
  ?>
88
- <?php if(isset($fb_post['full_picture']) && !empty($fb_post['full_picture'])) : ?>
89
  <a href="<?php echo $fb_post['link'] ?>" rel="nofollow" target="_blank">
90
  <img src="<?php echo $fb_post['full_picture'] ?>" width="100%" height="auto" /><br>
91
  </a>
7
  $caption = isset($fb_post['caption']) && !empty($fb_post['caption']) ? $fb_post['caption'] : null ;
8
  $name = isset($fb_post['name']) && !empty($fb_post['name']) ? $fb_post['name'] : null ;
9
  $is_fb_link = strpos($fb_post['link'],'facebook.com') !== false;
10
+ $video_ratio = (WP_Embed_FB_Plugin::get_option('video_ratio') == 'true') ? true : false;
11
  if(isset($fb_post['message']) && !empty($fb_post['message'])) :
12
  $message = str_replace($fb_post['link'],'',$fb_post['message']);
13
  $message = WP_Embed_FB::make_clickable($message);
14
  endif;
15
+ $name = $name ? '<p class="caption-title"><a href="'.$name.'" title="'.$name.'" target="_blank" rel="nofollow">'.$name.'</a></p>':'';
16
  $description = $description ? '<div class="caption-description">'.$description.'</div>':'';
17
  $caption = $caption ? '<p class="caption-link"><a href="'.$fb_post["link"].'" rel="nofollow">'.$caption.'</a></p>':'';
18
  $link_info = $name.$description.$caption;
19
  $icon = isset($fb_post["icon"]) ? '<img class="icon" src="'.$fb_post["icon"].'">' : '';
20
  $old_time_zone = date_default_timezone_get();
21
+ date_default_timezone_set(WP_Embed_FB_Plugin::get_timezone());
22
  $post_time = $icon.date_i18n('l, j F Y g:s a', strtotime($fb_post['created_time'])) ;
23
  date_default_timezone_set($old_time_zone);
24
  ?>
42
  WP_Embed_FB::$width = $width_r;
43
  echo $link_info;
44
  } else {
45
+ $use_ratio = (WP_Embed_FB_Plugin::get_option('video_ratio') == 'true');
46
  echo '<div class="post-link">';
47
  echo $use_ratio ? '<div class="video">' : '';
48
  echo $wp_embed->shortcode(array('src'=>$fb_post['link'], 'width'=>$width - 20));
68
  case 'link':
69
  ?>
70
  <div class="post-link" style="max-width: <?php echo $width?>px;">
71
+ <?php if(isset($fb_post['full_picture']) && !empty($fb_post['full_picture'])) : ?>
72
+ <div class="relative-container fbpost-image">
73
+ <div class="relative" style="background-image: url('<?php echo $fb_post['full_picture'] ?>');" onclick="window.open('<?php echo $fb_post['link'] ?>', '_blank')"></div>
74
+ </div>
75
+ <?php endif ?>
76
  <?php if($fb_post["type"] == 'music') : ?>
77
  <p>
78
  <audio controls>
87
  case 'status':
88
  default:
89
  ?>
90
+ <?php if(isset($fb_post['full_picture'],$fb_post['link']) && !empty($fb_post['full_picture']) && !empty($fb_post['link'])) : ?>
91
  <a href="<?php echo $fb_post['link'] ?>" rel="nofollow" target="_blank">
92
  <img src="<?php echo $fb_post['full_picture'] ?>" width="100%" height="auto" /><br>
93
  </a>
templates/default/social-plugin.php CHANGED
@@ -1,19 +1,18 @@
1
  <div class="wef-measure" style="max-width: <?php echo $width ?>px;"></div>
2
  <?php
3
- switch($type){
4
  case 'page' :
5
  /** @noinspection PhpUndefinedVariableInspection */
6
- echo WEF_Social_Plugins::page_plugin('https://www.facebook.com/'.$fb_data['link'],$width);
7
  break;
8
  case 'video' :
9
- if(get_option('wpemfb_video_as_post','false') == 'true')
 
 
10
  /** @noinspection PhpUndefinedVariableInspection */
11
- echo WEF_Social_Plugins::embedded_post('https://www.facebook.com/'.$fb_data['link'],$width);
12
- else{
13
- /** @noinspection PhpUndefinedVariableInspection */
14
- echo WEF_Social_Plugins::embedded_video('https://www.facebook.com/'.$fb_data['link'],$width);
15
- if( get_option('wpemfb_video_download','false') == 'true' ){
16
- echo '<p class="wef-video-link"><a title="Download this video" href="http://www.freemake.com/free_video_downloader/">'.__('Download this video','wp-embed-facebook').'</a></p>';
17
  }
18
  }
19
 
@@ -22,6 +21,6 @@ switch($type){
22
  //case 'post' :
23
  default:
24
  /** @noinspection PhpUndefinedVariableInspection */
25
- echo WEF_Social_Plugins::embedded_post('https://www.facebook.com/'.$fb_data['link'],$width);
26
  break;
27
  }
1
  <div class="wef-measure" style="max-width: <?php echo $width ?>px;"></div>
2
  <?php
3
+ switch ( $type ) {
4
  case 'page' :
5
  /** @noinspection PhpUndefinedVariableInspection */
6
+ echo WEF_Social_Plugins::page_plugin( 'https://www.facebook.com/' . $fb_data['link'], $width );
7
  break;
8
  case 'video' :
9
+ if ( WP_Embed_FB_Plugin::get_option( 'video_as_post' ) == 'true' ) /** @noinspection PhpUndefinedVariableInspection */ {
10
+ echo WEF_Social_Plugins::embedded_post( 'https://www.facebook.com/' . $fb_data['link'], $width );
11
+ } else {
12
  /** @noinspection PhpUndefinedVariableInspection */
13
+ echo WEF_Social_Plugins::embedded_video( 'https://www.facebook.com/' . $fb_data['link'], $width );
14
+ if ( WP_Embed_FB_Plugin::get_option( 'video_download' ) == 'true' ) {
15
+ echo '<p class="wef-video-link"><a title="Download this video" href="http://www.freemake.com/free_video_downloader/">' . __( 'Download this video', 'wp-embed-facebook' ) . '</a></p>';
 
 
 
16
  }
17
  }
18
 
21
  //case 'post' :
22
  default:
23
  /** @noinspection PhpUndefinedVariableInspection */
24
+ echo WEF_Social_Plugins::embedded_post( 'https://www.facebook.com/' . $fb_data['link'], $width );
25
  break;
26
  }
templates/default/video.php CHANGED
@@ -1,8 +1,8 @@
1
  <?php
2
- $use_ratio = (get_option('wpemfb_video_ratio') == 'true');
3
  ?>
4
  <div class="wef-default" style="max-width: <?php echo $width ?>px">
5
- <?php echo $use_ratio ? '<div class="video">' : '' ?>
6
  <?php
7
  /** @noinspection PhpUndefinedVariableInspection */
8
  $url = $fb_data['source'];
1
  <?php
2
+ $use_ratio = (WP_Embed_FB_Plugin::get_option('video_ratio') == 'true');
3
  ?>
4
  <div class="wef-default" style="max-width: <?php echo $width ?>px">
5
+ <?php echo $use_ratio ? '<div class="relative-container video">' : '' ?>
6
  <?php
7
  /** @noinspection PhpUndefinedVariableInspection */
8
  $url = $fb_data['source'];
wp-embed-facebook.php CHANGED
@@ -4,7 +4,7 @@ Plugin Name: WP Embed Facebook
4
  Plugin URI: http://www.wpembedfb.com
5
  Description: Embed any public Facebook video, photo, album, event, page, profile, or post. Copy the facebook url to a single line on your post, or use shortcode [facebook url ] more information at <a href="http://www.wpembedfb.com" title="plugin website">www.wpembedfb.com</a>
6
  Author: Miguel Sirvent
7
- Version: 2.0.9.1
8
  Author URI: http://www.wpembedfb.com
9
  Text Domain: wp-embed-facebook
10
  Domain Path: /lang
@@ -15,9 +15,9 @@ require_once('lib/class-wp-embed-fb-plugin.php');
15
  require_once('lib/class-wef-social-plugins.php');
16
  require_once('lib/class-wp-embed-fb.php');
17
 
18
- //Session start when there is a facebook app
19
  add_action('init',array('WP_Embed_FB_Plugin','init'),999);
20
- //Translation string
21
  add_action('plugins_loaded',array('WP_Embed_FB_Plugin','plugins_loaded'));
22
  //Donate or review notice
23
  add_action('admin_notices',array('WP_Embed_FB_Plugin','admin_notices'));
@@ -30,7 +30,7 @@ register_deactivation_hook(__FILE__, array('WP_Embed_FB_Plugin', 'deactivate'));
30
 
31
  add_action('wp_enqueue_scripts', array('WP_Embed_FB_Plugin', 'wp_enqueue_scripts') );
32
 
33
- if( get_option('wpemfb_fb_root','true') === 'true' )
34
  add_filter('the_content', array('WP_Embed_FB','fb_root'),10,1);
35
 
36
  add_shortcode('facebook', array('WP_Embed_FB','shortcode') );
4
  Plugin URI: http://www.wpembedfb.com
5
  Description: Embed any public Facebook video, photo, album, event, page, profile, or post. Copy the facebook url to a single line on your post, or use shortcode [facebook url ] more information at <a href="http://www.wpembedfb.com" title="plugin website">www.wpembedfb.com</a>
6
  Author: Miguel Sirvent
7
+ Version: 2.1
8
  Author URI: http://www.wpembedfb.com
9
  Text Domain: wp-embed-facebook
10
  Domain Path: /lang
15
  require_once('lib/class-wef-social-plugins.php');
16
  require_once('lib/class-wp-embed-fb.php');
17
 
18
+ ////Session start when there is a facebook app
19
  add_action('init',array('WP_Embed_FB_Plugin','init'),999);
20
+ ////Translation string
21
  add_action('plugins_loaded',array('WP_Embed_FB_Plugin','plugins_loaded'));
22
  //Donate or review notice
23
  add_action('admin_notices',array('WP_Embed_FB_Plugin','admin_notices'));
30
 
31
  add_action('wp_enqueue_scripts', array('WP_Embed_FB_Plugin', 'wp_enqueue_scripts') );
32
 
33
+ if( WP_Embed_FB_Plugin::get_option('fb_root') === 'true' )
34
  add_filter('the_content', array('WP_Embed_FB','fb_root'),10,1);
35
 
36
  add_shortcode('facebook', array('WP_Embed_FB','shortcode') );