/** * 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 ''; }