LittleDemon WebShell


Linux webm010.cluster103.gra.hosting.ovh.net 5.15.206-ovh-vps-grsec-zfs-classid #1 SMP Fri May 15 02:41:25 UTC 2026 x86_64
Path : /home/cuisinesj/www/new/wp-content/themes/Avenue/framework/widgets/
File Upload :
Command :
Current File : /home/cuisinesj/www/new/wp-content/themes/Avenue/framework/widgets/social_counter_widget.php

<?php
add_action('widgets_init', 'pyre_social_counter_load_widgets');

function pyre_social_counter_load_widgets()
{
	register_widget('Pyre_Social_Counter_Widget');
}

class Pyre_Social_Counter_Widget extends WP_Widget {
	
	function Pyre_Social_Counter_Widget()
	{
		$widget_ops = array('classname' => 'pyre_social_counter', 'description' => 'Show number of RSS subscribes, twitter followers and facebook fans.');

		$control_ops = array('id_base' => 'pyre_social_counter-widget');

		$this->WP_Widget('pyre_social_counter-widget', 'Avenue Theme: Social Counter', $widget_ops, $control_ops);
	}
	
	function widget($args, $instance)
	{
		extract($args);

		echo $before_widget;

		if($title) {
			echo $before_title.$title.$after_title;
		}
		$consumer_key = $instance['consumer_key'];
		$consumer_secret = $instance['consumer_secret'];
		$access_token = $instance['access_token'];
		$access_token_secret = $instance['access_token_secret'];
		$twitter_id = $instance['twitter_id'];
		?>
		<!-- BEGIN WIDGET -->
		<?php $rss = get_bloginfo('rss2_url'); ?>
		<div class="social-item">
			<a href='<?php echo $rss; ?>'><img src="<?php bloginfo('template_directory'); ?>/images/rss-big.png" alt="RSS"  width='32' height='32' /></a>

			<span class="social-count"><?php _e('Subscribe', 'Avenue'); ?></span>
			<span class="social-descrip"><?php _e('to RSS Feed', 'Avenue'); ?></span>
		</div>
		
		<?php if($twitter_id): ?>
		<?php
		if($twitter_id && $consumer_key && $consumer_secret && $access_token && $access_token_secret) { 
			$transName = 'twitter_count_'.$args['widget_id'];
			$cacheTime = 10;
			if(false === ($twitterData = get_transient($transName))) {
			     // require the twitter auth class
			     @require_once 'twitteroauth/twitteroauth.php';
			     $twitterConnection = new TwitterOAuth(
								$consumer_key,	// Consumer Key
								$consumer_secret,   	// Consumer secret
								$access_token,       // Access token
								$access_token_secret    	// Access token secret
								);
			    $twitterData = $twitterConnection->get(
								  'statuses/user_timeline',
								  array(
								    'screen_name'     => $twitter_id,
								    'count'           => 1,
								  )
								);
			     if($twitterConnection->http_code != 200)
			     {
			          $twitterData = get_transient($transName);
			     }

			     // Save our new transient.
			     set_transient($transName, $twitterData, 60 * $cacheTime);
			};
			$twitter = get_transient($transName);
		}
		?>
		<div class="social-item">
			<a href='http://twitter.com/<?php echo get_option('pyre_twitter_id'); ?>'><img src="<?php bloginfo('template_directory'); ?>/images/twitter-big.png" alt="Twitter"  width='32' height='32' /></a>
			<?php
			if($twitter):
			?>
			<span class="social-count"><?php echo $twitter[0]->user->followers_count; ?></span>
			<span class="social-descrip"><?php _e('Followers', 'Avenue'); ?></span>
			<?php endif; ?>
		</div>
		<?php endif; ?>
		
		<?php if(get_option('pyre_facebook_id')): ?>
		<div class="social-item last">
			<?php
			$interval = 3600;
			
			if($_SERVER['REQUEST_TIME'] > get_option('pyre_facebook_cache_time')) {
				@$api = wp_remote_get('http://graph.facebook.com/' . get_option('pyre_facebook_id'));
				@$json = json_decode($api['body']);
				
				if($json->likes >= 1) {
					update_option('pyre_facebook_cache_time', $_SERVER['REQUEST_TIME'] + $interval);
					update_option('pyre_facebook_followers', $json->likes);
					update_option('pyre_facebook_link', $json->link);
				}
			}
			?>
			
			<a href='<?php echo get_option('pyre_facebook_link'); ?>'><img src="<?php bloginfo('template_directory'); ?>/images/facebook-big.png" alt="Facebook"  width='32' height='32' /></a>
			
			<span class="social-count"><?php echo get_option('pyre_facebook_followers'); ?></span>
			<span class="social-descrip"><?php _e('Fans', 'Avenue'); ?></span>
		</div>
		<?php endif; ?>
		<!-- END WIDGET -->
		<?php
		echo $after_widget;
	}
	
	function update($new_instance, $old_instance)
	{
		$instance = $old_instance;

		$instance['consumer_key'] = $new_instance['consumer_key'];
		$instance['consumer_secret'] = $new_instance['consumer_secret'];
		$instance['access_token'] = $new_instance['access_token'];
		$instance['access_token_secret'] = $new_instance['access_token_secret'];
		$instance['twitter_id'] = $new_instance['twitter_id'];

		return $instance;
	}

	function form($instance)
	{ $instance = wp_parse_args((array) $instance, $defaults); ?>
		<p><a href="http://dev.twitter.com/apps">Find or Create your Twitter App</a>
		<p>
			<label for="<?php echo $this->get_field_id('consumer_key'); ?>">Consumer Key:</label>
			<input class="widefat" style="width: 216px;" id="<?php echo $this->get_field_id('consumer_key'); ?>" name="<?php echo $this->get_field_name('consumer_key'); ?>" value="<?php echo $instance['consumer_key']; ?>" />
		</p>
		
		<p>
			<label for="<?php echo $this->get_field_id('consumer_secret'); ?>">Consumer Secret:</label>
			<input class="widefat" style="width: 216px;" id="<?php echo $this->get_field_id('consumer_secret'); ?>" name="<?php echo $this->get_field_name('consumer_secret'); ?>" value="<?php echo $instance['consumer_secret']; ?>" />
		</p>

		<p>
			<label for="<?php echo $this->get_field_id('access_token'); ?>">Access Token:</label>
			<input class="widefat" style="width: 216px;" id="<?php echo $this->get_field_id('access_token'); ?>" name="<?php echo $this->get_field_name('access_token'); ?>" value="<?php echo $instance['access_token']; ?>" />
		</p>

		<p>
			<label for="<?php echo $this->get_field_id('access_token_secret'); ?>">Access Token Secret:</label>
			<input class="widefat" style="width: 216px;" id="<?php echo $this->get_field_id('access_token_secret'); ?>" name="<?php echo $this->get_field_name('access_token_secret'); ?>" value="<?php echo $instance['access_token_secret']; ?>" />
		</p>
		
		<p>
			<label for="<?php echo $this->get_field_id('twitter_id'); ?>">Twitter ID:</label>
			<input class="widefat" style="width: 216px;" id="<?php echo $this->get_field_id('twitter_id'); ?>" name="<?php echo $this->get_field_name('twitter_id'); ?>" value="<?php echo $instance['twitter_id']; ?>" />
		</p>
	<?php }
}
?>

LittleDemon - FACEBOOK
[ KELUAR ]