Example #1
0
/**
* Builds the Like button
*
* @return	string	renedered template for the Like button
*/
function construct_fblikebutton()
{
    global $show, $vbulletin;
    // make sure like button is enabled for the given page
    if (THIS_SCRIPT == 'showthread' and $vbulletin->options['facebooklikethreads'] or THIS_SCRIPT == 'entry' and $vbulletin->options['facebooklikeblogentries'] or THIS_SCRIPT == 'vbcms' and isset($vbulletin->vbcms['content_type']) and $vbulletin->vbcms['content_type'] == 'Article' and $vbulletin->options['facebooklikecmsarticles']) {
        $show['fb_likebutton'] = true;
        $show['loadfbroot'] = !is_facebookenabled();
        $templater = vB_Template::create('facebook_likebutton');
        $templater->register('appid', urlencode($vbulletin->options['facebookappid']));
        // Removed IE/OPERA check, See VBIV-15694
        $templater->register('href', get_fbcanonicalurl());
        /*		
        		if(is_browser('ie') || is_browser('opera'))
        		{
        			$templater->register('href', urlencode(get_fbcanonicalurl()));
        		}
        		else
        		{
        			$templater->register('href', get_fbcanonicalurl()); 
        		}
        */
    } else {
        $retval = '';
        $show['fb_likebutton'] = false;
    }
    ($hook = vBulletinHook::fetch_hook('fb_like_button')) ? eval($hook) : false;
    if ($show['fb_likebutton']) {
        return $templater->render();
    } else {
        return $retval;
    }
}
Example #2
0
/**
* Builds the Like button
* 
* @return	string	renedered template for the Like button
*/
function construct_fblikebutton()
{
	global $show, $vbulletin;
	
	// make sure like button is enabled for the given page
	if ((THIS_SCRIPT == 'showthread' AND $vbulletin->options['facebooklikethreads'])
		OR (THIS_SCRIPT == 'entry' AND $vbulletin->options['facebooklikeblogentries'])
		OR (THIS_SCRIPT == 'vbcms' AND isset($vbulletin->vbcms['content_type']) AND $vbulletin->vbcms['content_type']=='Article' AND $vbulletin->options['facebooklikecmsarticles'])
	)
	{
		$show['fb_likebutton'] = true;
		$templater = vB_Template::create('facebook_likebutton');
		$templater->register('href', urlencode(get_fbcanonicalurl()));
		return $templater->render();
	}
	
	// if like button is not enabled, return null data
	else
	{
		$show['fb_likebutton'] = false;
		return '';
	}
}