';
return preg_replace('#'.$search.'#', $fbp_content.$search, $content);
}
function fbp_add_social($content, &$smarty)
{
global $conf;
$fbp_content .= '
';
// iframe implementation
/* $fbp_content = '
';*/
// XFBML implementation
/*$fbp_content .= '
';*/
$fbp_content .= '
';
$fbp_content .= '
';
return $content.$fbp_content;
}
function fbp_loc_begin_picture()
{
global $template, $user, $page, $conf, $picture;
// set prefilter
$template->set_prefilter('header', 'fbp_header');
//~ $template->set_prefilter('header', 'fbp_add_fb_init');
if ($conf['fbp']['social_plugin_like_button']['enabled'])
{
$template->set_prefilter('default_content', 'fbp_add_social');
}
}
//~ function fbp_loc_end_picture()
function fbp_render_element_content($content, $current_picture)
{
global $template, $user, $page, $conf, $picture;
if ($conf['fbp']['social_plugin_like_button']['enabled'])
{
//~ $template->set_prefilter('default_content', 'fbp_add_social');
// Always use full url for FB social plugin
//~ set_make_full_url();
// define language
$template->assign('LANGUAGE', $user['language']);
// define picture FB link
set_make_full_url();
if ($conf['fbp']['social_plugin_like_button']['url_type'] == 'image')
{
$fbp_url_picture = get_element_url($picture['current']);
}
else
{
$fbp_url_picture = make_picture_url(array('image_id' => $page['image_id']));
}
unset_make_full_url();
$template->assign('FBP_URL_PICTURE', $fbp_url_picture);
$template->assign('FBP_SOCIAL_PLUGIN_LIKE_BUTTON', $conf['fbp']['social_plugin_like_button']);
}
return $content;
}
function ftp_loc_end_section_init()
{
global $conf;
if ($conf['fbp']['social_plugin_like_button']['enabled'])
{
if ($conf['fbp']['allow_fb_access_private_page'])
{
global $user, $page;
// No restristion for facebook user
if (preg_match('/'.FBP_IP_FB. '/', $_SERVER["REMOTE_ADDR"]))
{
//Allow guest access
$conf['guest_access'] = true;
// No forbidden categorie
$user['forbidden_categories'] = '';
$user['level'] = max($conf['available_permission_levels']);
$page['rank_of'][$page['image_id']] = 0;
$page['items'] = array_flip($page['rank_of']);
}
}
}
}
if ($conf['fbp']['social_plugin_like_button']['enabled'])
{
add_event_handler('loc_begin_picture', 'fbp_loc_begin_picture');
add_event_handler('render_element_content', 'fbp_render_element_content', null, 2);
//~ add_event_handler('loc_end_picture', 'fbp_loc_end_picture');
add_event_handler('loc_end_section_init', 'ftp_loc_end_section_init');
}
?>