include_once "modules/func.twitter.views.php";
include_once "modules/func.yelp.views.php";
include_once "modules/func.places.views.php";
include_once "modules/func.citysearch.views.php";
if (!loggedIn()) {
    echo '<script> window.location="login.php"; </script> ';
} else {
    $monthly_metrics = getMonthlyDashboardMetrics();
    if (isset($monthly_metrics['totalsForAllResults']['ga:pageviews'])) {
        $page_views = $monthly_metrics['totalsForAllResults']['ga:pageviews'];
    }
    if (isset($monthly_metrics['totalsForAllResults']['ga:visitors'])) {
        $unique_visitors = $monthly_metrics['totalsForAllResults']['ga:visitors'];
    }
    $facebook_fans = getFacebookFans();
    $twitter_followers = getTwitterFollowers();
    $yelp_review_score = getYelpReviewScore();
    $places_review_score = getPlacesReviewScore();
    $citysearch_review_score = getCitysearchReviewScore();
}
?>

<?php 
include_once 'header.php';
?>
</head>

<body>
    <?php 
include_once 'navbar.php';
?>
    function widget($args, $instance)
    {
        extract($args);
        global $bd_data;
        $title = apply_filters('widget_title', $instance['title']);
        $count = new COUNT_CLASS();
        $rssurl = $instance['rssurl'];
        $twitter_un = $instance['twitterun'];
        $facebookn = $instance['facebookn'];
        $gplusn = $instance['gplusn'];
        $youtubeun = $instance['youtubeun'];
        $vimocn = $instance['vimocn'];
        $soundcloudun = $instance['soundcloudun'];
        $socialstyle - $instance['socialstyle'];
        $social_count['twitter'] = $count->get_twitter_count($twitter_un);
        $social_count['facebook'] = $count->get_facebook_count($facebookn);
        $social_count['gplus'] = $count->get_gplus_count($gplusn);
        $social_count['youtube'] = $count->get_youtube_count($youtubeun);
        $social_count['vimo'] = $count->get_vimo_count($vimocn);
        $social_count['soundcloud'] = $count->get_soundcloud_count($soundcloudun);
        $getNew = getTwitterFollowers();
        $getNewName = bdayh_get_option('twitter_username');
        $newTwitter = $instance['twitter'];
        ?>
        <div id="social-counter-widget" class="<?php 
        echo $instance['socialstyle'];
        ?>
-SC">
            <ul class="social-counter-widget">
                <?php 
        /**
         * Twitter
         */
        if (trim($newTwitter) != '') {
            echo '<li class="social-counter-twitter"><a href="http://twitter.com/' . $getNewName . '" target="_blank"><i class="icon social_icon-twitter"></i><span>' . @number_format($getNew) . '</span><small>' . __('Followers', 'bd') . '</small></a></li> ';
        }
        /**
         * Facebook
         */
        if (trim($facebookn) != '') {
            echo '<li class="social-counter-facebook"><a href="http://www.facebook.com/' . $facebookn . '" target="_blank"><i class="icon social_icon-facebook"></i><span>' . $social_count['facebook'] . '</span><small>' . __('Fans', 'bd') . '</small></a></li> ';
        }
        /**
         * Feed
         */
        if ($rssurl) {
            echo '<li class="social-counter-rss"><a href="' . $rssurl . '" target="_blank"><i class="icon social_icon-rss"></i><span>' . __('Subscribe', 'bd') . '</span><small>' . __('Rss', 'bd') . '</small></a></li> ';
        }
        /**
         * Google+
         */
        if (trim($gplusn) != '') {
            echo '<li class="social-counter-gplus"><a href="https://plus.google.com/' . $gplusn . '" target="_blank"><i class="icon social_icon-google"></i><span>' . $social_count['gplus'] . '</span><small>' . __('Followers', 'bd') . '</small></a></li> ';
        }
        /**
         * Youtube
         */
        if (trim($youtubeun) != '') {
            echo '<li class="social-counter-youtube"><a href="http://www.youtube.com/user/' . $youtubeun . '" target="_blank"><i class="icon social_icon-youtube"></i><span>' . $social_count['youtube'] . '</span><small>' . __('Subscribers', 'bd') . '</small></a></li> ';
        }
        /**
         * Vimeo
         */
        if (trim($vimocn) != '') {
            echo '<li class="social-counter-vimo"><a href="http://vimeo.com/channels/' . $vimocn . '" target="_blank"><i class="icon social_icon-vimeo"></i><span>' . $social_count['vimo'] . '</span><small>' . __('Subscribers', 'bd') . '</small></a></li> ';
        }
        /**
         * Souncloud
         */
        if (trim($soundcloudun) != '') {
            echo '<li class="social-counter-soundcloud"><a href="http://soundcloud.com/' . $soundcloudun . '" target="_blank"><i class="icon social_icon-soundcloud"></i><span>' . $social_count['soundcloud'] . '</span><small>' . __('Followers', 'bd') . '</small></a></li> ';
        }
        ?>
            </ul>
        </div> <!-- End Social Counter/-->
        <?php 
    }