示例#1
0
    function widget($args, $instance)
    {
        $facebook_page = @$instance['facebook'];
        $rss_id = @$instance['rss'];
        $twitter_id = @$instance['twitter'];
        $youtube_url = @$instance['youtube'];
        $vimeo_url = @$instance['vimeo'];
        $dribbble_url = @$instance['dribbble'];
        $soundcloud_url = @$instance['soundcloud'];
        $soundcloud_api = @$instance['soundcloud_api'];
        $behance_url = @$instance['behance'];
        $behance_api = @$instance['behance_api'];
        $instagram_url = @$instance['instagram'];
        $instagram_api = @$instance['instagram_api'];
        $new_window = @$instance['new_window'];
        if ($new_window) {
            $new_window = ' target="_blank" ';
        } else {
            $new_window = '';
        }
        $counter = 0;
        if ($rss_id) {
            $counter++;
        }
        if ($twitter_id) {
            $counter++;
        }
        if ($facebook_page) {
            $counter++;
        }
        if ($youtube_url) {
            $counter++;
        }
        if ($vimeo_url) {
            $counter++;
        }
        if ($dribbble_url) {
            $counter++;
        }
        if ($soundcloud_url) {
            $counter++;
        }
        if ($behance_url) {
            $counter++;
        }
        if ($instagram_url) {
            $counter++;
        }
        ?>
		<div class="widget widget-counter col<?php 
        echo $counter;
        ?>
">
			<ul>
			<?php 
        if ($rss_id) {
            ?>
				<li class="rss-subscribers">
					<a href="<?php 
            echo $rss_id;
            ?>
"<?php 
            echo $new_window;
            ?>
>
						<strong class="tieicon-rss"></strong>
						<span><?php 
            _e('Subscribe', 'tie');
            __('Subscribers', 'tie');
            ?>
</span>
						<small><?php 
            _e('To RSS Feed', 'tie');
            ?>
</small>
					</a>
				</li>
			<?php 
        }
        ?>
			<?php 
        if ($twitter_id) {
            $twitter = tie_followers_count();
            ?>
				<li class="twitter-followers">
					<a href="<?php 
            echo $twitter['page_url'];
            ?>
"<?php 
            echo $new_window;
            ?>
>
						<strong class="tieicon-twitter"></strong>
						<span><?php 
            echo @number_format($twitter['followers_count']);
            ?>
</span>
						<small><?php 
            _e('Followers', 'tie');
            ?>
</small>
					</a>
				</li>
			<?php 
        }
        ?>
			<?php 
        if ($facebook_page) {
            $facebook = tie_facebook_fans($facebook_page);
            ?>
				<li class="facebook-fans">
					<a href="<?php 
            echo $facebook_page;
            ?>
"<?php 
            echo $new_window;
            ?>
>
						<strong class="tieicon-facebook"></strong>
						<span><?php 
            echo @number_format($facebook);
            ?>
</span>
						<small><?php 
            _e('Fans', 'tie');
            ?>
</small>
					</a>
				</li>
			<?php 
        }
        ?>
			<?php 
        if ($youtube_url) {
            $youtube = tie_youtube_subs($youtube_url);
            ?>
				<li class="youtube-subs">
					<a href="<?php 
            echo $youtube_url;
            ?>
"<?php 
            echo $new_window;
            ?>
>
						<strong class="tieicon-youtube"></strong>
						<span><?php 
            echo @number_format($youtube);
            ?>
</span>
						<small><?php 
            _e('Subscribers', 'tie');
            ?>
</small>
					</a>
				</li>
			<?php 
        }
        ?>
			<?php 
        if ($vimeo_url) {
            $vimeo = tie_vimeo_count($vimeo_url);
            ?>
				<li class="vimeo-subs">
					<a href="<?php 
            echo $vimeo_url;
            ?>
"<?php 
            echo $new_window;
            ?>
>
						<strong class="tieicon-vimeo"></strong>
						<span><?php 
            echo @number_format($vimeo);
            ?>
</span>
						<small><?php 
            _e('Subscribers', 'tie');
            ?>
</small>
					</a>
				</li>
			<?php 
        }
        ?>
			<?php 
        if ($dribbble_url) {
            $dribbble = tie_dribbble_count($dribbble_url);
            ?>
				<li class="dribbble-followers">
					<a href="<?php 
            echo $dribbble_url;
            ?>
"<?php 
            echo $new_window;
            ?>
>
						<strong class="tieicon-dribbble"></strong>
						<span><?php 
            echo @number_format($dribbble);
            ?>
</span>
						<small><?php 
            _e('Followers', 'tie');
            ?>
</small>
					</a>
				</li>
			<?php 
        }
        ?>
			<?php 
        if ($soundcloud_url && $soundcloud_api) {
            $soundcloud = tie_soundcloud_count($soundcloud_url, $soundcloud_api);
            ?>
				<li class="soundcloud-followers">
					<a href="<?php 
            echo $soundcloud_url;
            ?>
"<?php 
            echo $new_window;
            ?>
>
						<strong class="tieicon-soundcloud"></strong>
						<span><?php 
            echo @number_format($soundcloud);
            ?>
</span>
						<small><?php 
            _e('Followers', 'tie');
            ?>
</small>
					</a>
				</li>
			<?php 
        }
        ?>
	
			<?php 
        if ($behance_url && $behance_api) {
            $behance = tie_behance_count($behance_url, $behance_api);
            ?>
				<li class="behance-followers">
					<a href="<?php 
            echo $behance_url;
            ?>
"<?php 
            echo $new_window;
            ?>
>
						<strong class="tieicon-behance"></strong>
						<span><?php 
            echo @number_format($behance);
            ?>
</span>
						<small><?php 
            _e('Followers', 'tie');
            ?>
</small>
					</a>
				</li>
			<?php 
        }
        ?>
			<?php 
        if ($instagram_url && $instagram_api) {
            $instagram = tie_instagram_count($instagram_url, $instagram_api);
            ?>
				<li class="instagram-followers">
					<a href="<?php 
            echo $instagram_url;
            ?>
"<?php 
            echo $new_window;
            ?>
>
						<strong class="tieicon-instagram"></strong>
						<span><?php 
            echo @number_format($instagram);
            ?>
</span>
						<small><?php 
            _e('Followers', 'tie');
            ?>
</small>
					</a>
				</li>
			<?php 
        }
        ?>

			</ul>
		</div>
		
	<?php 
    }
    function widget($args, $instance)
    {
        $facebook_page = $instance['facebook'];
        $rss_id = $instance['rss'];
        $twitter_id = $instance['twitter'];
        $youtube_url = $instance['youtube'];
        $vimeo_url = $instance['vimeo'];
        $dribbble_url = $instance['dribbble'];
        $new_window = $instance['new_window'];
        if ($new_window) {
            $new_window = ' target="_blank" ';
        } else {
            $new_window = '';
        }
        $counter = 0;
        if ($rss_id) {
            $counter++;
        }
        if ($twitter_id) {
            $counter++;
        }
        if ($facebook_page) {
            $counter++;
        }
        if ($youtube_url) {
            $counter++;
        }
        if ($vimeo_url) {
            $counter++;
        }
        if ($dribbble_url) {
            $counter++;
        }
        ?>
		<div class="widget widget-counter col<?php 
        echo $counter;
        ?>
">
			<ul>
			<?php 
        if ($rss_id) {
            ?>
				<li class="rss-subscribers">
					<a href="<?php 
            echo $rss_id;
            ?>
"<?php 
            echo $new_window;
            ?>
>
						<strong></strong>
						<span><?php 
            _e('Subscribe', 'tie');
            __('Subscribers', 'tie');
            ?>
</span>
						<small><?php 
            _e('To RSS Feed', 'tie');
            ?>
</small>
					</a>
				</li>
			<?php 
        }
        ?>
			<?php 
        if ($twitter_id) {
            $twitter = tie_followers_count();
            ?>
				<li class="twitter-followers">
					<a href="<?php 
            echo $twitter['page_url'];
            ?>
"<?php 
            echo $new_window;
            ?>
>
						<strong></strong>
						<span><?php 
            echo @number_format($twitter['followers_count']);
            ?>
</span>
						<small><?php 
            _e('Followers', 'tie');
            ?>
</small>
					</a>
				</li>
			<?php 
        }
        ?>
			<?php 
        if ($facebook_page) {
            $facebook = tie_facebook_fans($facebook_page);
            ?>
				<li class="facebook-fans">
					<a href="<?php 
            echo $facebook_page;
            ?>
"<?php 
            echo $new_window;
            ?>
>
						<strong></strong>
						<span><?php 
            echo @number_format($facebook);
            ?>
</span>
						<small><?php 
            _e('Fans', 'tie');
            ?>
</small>
					</a>
				</li>
			<?php 
        }
        ?>
			<?php 
        if ($youtube_url) {
            $youtube = tie_youtube_subs($youtube_url);
            ?>
				<li class="youtube-subs">
					<a href="<?php 
            echo $youtube_url;
            ?>
"<?php 
            echo $new_window;
            ?>
>
						<strong></strong>
						<span><?php 
            echo @number_format($youtube);
            ?>
</span>
						<small><?php 
            _e('Subscribers', 'tie');
            ?>
</small>
					</a>
				</li>
			<?php 
        }
        ?>
			<?php 
        if ($vimeo_url) {
            $vimeo = tie_vimeo_count($vimeo_url);
            ?>
				<li class="vimeo-subs">
					<a href="<?php 
            echo $vimeo_url;
            ?>
"<?php 
            echo $new_window;
            ?>
>
						<strong></strong>
						<span><?php 
            echo @number_format($vimeo);
            ?>
</span>
						<small><?php 
            _e('Subscribers', 'tie');
            ?>
</small>
					</a>
				</li>
			<?php 
        }
        ?>
			<?php 
        if ($dribbble_url) {
            $dribbble = tie_dribbble_count($dribbble_url);
            ?>
				<li class="dribbble-followers">
					<a href="<?php 
            echo $dribbble_url;
            ?>
"<?php 
            echo $new_window;
            ?>
>
						<strong></strong>
						<span><?php 
            echo @number_format($dribbble);
            ?>
</span>
						<small><?php 
            _e('Followers', 'tie');
            ?>
</small>
					</a>
				</li>
			<?php 
        }
        ?>
			
			
			</ul>
		</div>
		
	<?php 
    }