Skip to content

Commit

Permalink
Creating a new function to generate an improved wrapper id
Browse files Browse the repository at this point in the history
  • Loading branch information
cameronjonesweb committed Apr 2, 2016
1 parent 812c85f commit 50232a2
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion facebook-page-feed-graph-api.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,10 @@ function facebook_page_plugin_dashboard_widget_callback() {

}

function facebook_page_plugin_generate_wrapper_id() {
return substr( str_shuffle( str_repeat( implode( '', array_merge( range( 'A', 'Z' ), range( 'a', 'z' ) ) ), 5 ) ), 0, 15 );
}

//Client side stuff
//Parse shortcode
function facebook_page_plugin( $filter ) {
Expand All @@ -115,7 +119,7 @@ function facebook_page_plugin( $filter ) {
), $filter );
if(isset($a['href']) && !empty($a['href'])){
$a['language'] = str_replace("-", "_", $a['language']);
$return .= '<div class="cameronjonesweb_facebook_page_plugin" data-version="' . CJW_FBPP_PLUGIN_VER . '" id="' . preg_replace("/[^a-zA-Z]+/", "",substr(md5(rand()), 0, 15)) . '">';
$return .= '<div class="cameronjonesweb_facebook_page_plugin" data-version="' . CJW_FBPP_PLUGIN_VER . '" id="' . $this->facebook_page_plugin_generate_wrapper_id() . '">';
$return .= '<div id="fb-root"></div><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/' . $a['language'] . '/sdk.js#xfbml=1&version=v2.5&appId=846690882110183";fjs.parentNode.insertBefore(js, fjs); }(document, \'script\', \'facebook-jssdk\'));</script>';
$return .= '<div class="fb-page" data-href="https://facebook.com/' . $a["href"] . '" ';
if(isset($a['width']) && !empty($a['width'])){
Expand Down

0 comments on commit 50232a2

Please sign in to comment.