?> <p class="post-time" ><?php echo $post_time; ?> </p> <?php echo $message ? '<p>' . $message . '</p>' : ''; switch ($fb_post["type"]) { case 'video': if ($is_fb_link) { $raw = WP_Embed_FB::$raw; $width_r = WP_Embed_FB::$width; WP_Embed_FB::$raw = true; WP_Embed_FB::$width = $width - 40; echo $wp_embed->shortcode(array('src' => $fb_post['link'])); WP_Embed_FB::$raw = $raw; WP_Embed_FB::$width = $width_r; echo $link_info; } else { $use_ratio = get_option('wpemfb_video_ratio') == 'true'; echo '<div class="post-link">'; echo $use_ratio ? '<div class="video">' : ''; echo $wp_embed->shortcode(array('src' => $fb_post['link'], 'width' => $width - 20)); echo $use_ratio ? '</div>' : ''; echo $link_info; echo '</div>'; } break; case 'event': WP_Embed_FB::$width = $width - 40; echo $wp_embed->shortcode(array('src' => $fb_post['link']));
/** * Shortcode function * [facebook='url' width='600' raw='true' social_plugin='true' posts='2' ] width is optional * @param array $atts [0]=>url ['width']=>embed width ['raw']=>for videos and photos * @return string */ static function shortcode($atts) { if (!empty($atts) && isset($atts[0])) { $clean = trim($atts[0], '='); $juice = str_replace(array('https', 'http', '://facebook.com/', '://m.facebook.com/', '://facebook.com/', '://www.facebook.com/'), '', $clean); if (isset($atts['width'])) { self::$width = $atts['width']; } if (isset($atts['raw'])) { if ($atts['raw'] == 'true') { self::$raw = true; } else { self::$raw = false; } } if (isset($atts['social_plugin'])) { if ($atts['social_plugin'] == 'true') { self::$raw = false; } else { self::$raw = true; } } if (isset($atts['theme'])) { wp_enqueue_style('wpemfb-' . $atts['theme'], WP_Embed_FB_Plugin::get_url() . 'templates/' . $atts['theme'] . '/' . $atts['theme'] . '.css', array(), false); self::$theme = $atts['theme']; } if (isset($atts['posts'])) { self::$num_posts = intval($atts['posts']); } $embed = self::fb_embed(array('https', '://www.facebook.com/', $juice)); return $embed; } return ''; }