e107inc/e107

View on GitHub
e107_plugins/social/e_module.php

Summary

Maintainability
A
0 mins
Test Coverage
F
0%
<?php

if(e_ADMIN_AREA !==true)
{

    e107::css('social', 'style.css');
//    e107::link(array('rel'=>'preload', 'href'=> "{e_PLUGIN}social/font/fontello.woff2?21917124", 'as' => "font", 'type'=>"font/woff2", 'crossorigin'   => 'anonymous'));
    e107::css('social' ,'css/social.css');

    $appID = false;

    $social = e107::pref('core','social_login');

    if(!empty($social) && is_array($social))
    {
        if(!empty($social['Facebook']['keys']['id']))
        {
            $appID = $social['Facebook']['keys']['id'];
        }

    }

    if(deftrue('XURL_TWITTER') && XURL_TWITTER !== '#')
    {
        $screenName = basename(XURL_TWITTER);
        e107::meta('twitter:site','@'.$screenName);
    }

    if(!empty($appID))
    {
        e107::meta('fb:app_id', $appID);

        $locale = strtolower(CORE_LC)."_".strtoupper(CORE_LC2);

        $init = "

            window.fbAsyncInit = function() {
                FB.init({
                appId      : '".$appID."',
                xfbml      : true,
                version    : 'v2.3'
                });
            };

            (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/".$locale."/sdk.js';
                fjs.parentNode.insertBefore(js, fjs);
            }(document, 'script', 'facebook-jssdk'));

            ";

        define('SOCIAL_FACEBOOK_INIT', $init);

    }
    else
    {
        define('SOCIAL_FACEBOOK_INIT', false);
    }


}