晋太元中,武陵人捕鱼为业。缘溪行,忘路之远近。忽逢桃花林,夹岸数百步,中无杂树,芳草鲜美,落英缤纷。渔人甚异之,复前行,欲穷其林。 林尽水源,便得一山,山有小口,仿佛若有光。便舍船,从口入。初极狭,才通人。复行数十步,豁然开朗。土地平旷,屋舍俨然,有良田、美池、桑竹之属。阡陌交通,鸡犬相闻。其中往来种作,男女衣着,悉如外人。黄发垂髫,并怡然自乐。 见渔人,乃大惊,问所从来。具答之。便要还家,设酒杀鸡作食。村中闻有此人,咸来问讯。自云先世避秦时乱,率妻子邑人来此绝境,不复出焉,遂与外人间隔。问今是何世,乃不知有汉,无论魏晋。此人一一为具言所闻,皆叹惋。余人各复延至其家,皆出酒食。停数日,辞去。此中人语云:“不足为外人道也。”(间隔 一作:隔绝) 既出,得其船,便扶向路,处处志之。及郡下,诣太守,说如此。太守即遣人随其往,寻向所志,遂迷,不复得路。 南阳刘子骥,高尚士也,闻之,欣然规往。未果,寻病终。后遂无问津者。
| DIR:/proc/self/root/home/salvufkx/salvatorefabbri.com/wp-content/themes/vega/lib/ |
| Current File : //proc/self/root/home/salvufkx/salvatorefabbri.com/wp-content/themes/vega/lib/widgets.lib.php |
<?php
/**
* Begin Recent Posts Custom Widgets
**/
class Custom_Recent_Posts extends WP_Widget {
function __construct() {
$widget_ops = array('classname' => 'Custom_Recent_Posts', 'description' => 'The recent posts with thumbnails' );
parent::__construct('Custom_Recent_Posts', 'Custom Recent Posts', $widget_ops);
}
function widget($args, $instance) {
extract($args, EXTR_SKIP);
echo $before_widget;
$items = empty($instance['items']) ? ' ' : apply_filters('widget_title', $instance['items']);
if(!is_numeric($items))
{
$items = 3;
}
if(!empty($items))
{
pp_posts('recent', $items, TRUE);
}
echo $after_widget;
}
function update($new_instance, $old_instance) {
$instance = $old_instance;
$instance['items'] = absint($new_instance['items']);
return $instance;
}
function form($instance) {
$instance = wp_parse_args( (array) $instance, array( 'items' => '') );
$items = strip_tags($instance['items']);
?>
<p><label for="<?php echo $this->get_field_id('items'); ?>">Items (default 3): <input class="widefat" id="<?php echo $this->get_field_id('items'); ?>" name="<?php echo $this->get_field_name('items'); ?>" type="text" value="<?php echo esc_attr($items); ?>" /></label></p>
<?php
}
}
register_widget('Custom_Recent_Posts');
/**
* End Recent Posts Custom Widgets
**/
/**
* Begin Popular Posts Custom Widgets
**/
class Custom_Popular_Posts extends WP_Widget {
function __construct() {
$widget_ops = array('classname' => 'Custom_Popular_Posts', 'description' => 'The popular posts with thumbnails' );
parent::__construct('Custom_Popular_Posts', 'Custom Popular Posts', $widget_ops);
}
function widget($args, $instance) {
extract($args, EXTR_SKIP);
echo $before_widget;
$items = empty($instance['items']) ? ' ' : apply_filters('widget_title', $instance['items']);
if(!is_numeric($items))
{
$items = 3;
}
if(!empty($items))
{
pp_posts('popular', $items, TRUE);
}
echo $after_widget;
}
function update($new_instance, $old_instance) {
$instance = $old_instance;
$instance['items'] = absint($new_instance['items']);
return $instance;
}
function form($instance) {
$instance = wp_parse_args( (array) $instance, array( 'items' => '') );
$items = strip_tags($instance['items']);
?>
<p><label for="<?php echo $this->get_field_id('items'); ?>">Items (default 3): <input class="widefat" id="<?php echo $this->get_field_id('items'); ?>" name="<?php echo $this->get_field_name('items'); ?>" type="text" value="<?php echo esc_attr($items); ?>" /></label></p>
<?php
}
}
register_widget('Custom_Popular_Posts');
/**
* End Popular Posts Custom Widgets
**/
/**
* Begin Twitter Feed Custom Widgets
**/
class Custom_Twitter extends WP_Widget {
function __construct() {
$widget_ops = array('classname' => 'Custom_Twitter', 'description' => 'Display your recent Twitter feed' );
parent::__construct('Custom_Twitter', 'Custom Twitter', $widget_ops);
}
function widget($args, $instance) {
extract($args, EXTR_SKIP);
echo $before_widget;
$twitter_username = empty($instance['twitter_username']) ? ' ' : apply_filters('widget_title', $instance['twitter_username']);
$title = $instance['title'];
$items = empty($instance['items']) ? ' ' : apply_filters('widget_title', $instance['items']);
$items = absint($items);
$consumer_key = get_option(SHORTNAME."_twitter_consumer_key");
$consumer_secret = get_option(SHORTNAME."_twitter_consumer_secret");
$access_token = get_option(SHORTNAME."_twitter_consumer_token");;
$access_token_secret = get_option(SHORTNAME."_twitter_consumer_token_secret");
if(!is_numeric($items))
{
$items = 5;
}
if(empty($title))
{
$title = 'Recent Tweets';
}
if(!empty($items) && !empty($twitter_username))
{
// Begin get user timeline
include_once (get_template_directory() . "/lib/twitter.lib.php");
$obj_twitter = new Twitter($twitter_username);
$obj_twitter->consumer_key = $consumer_key;
$obj_twitter->consumer_secret = $consumer_secret;
$obj_twitter->access_token = $access_token;
$obj_twitter->access_token_secret = $access_token_secret;
$tweets = $obj_twitter->get($items);
if(!empty($tweets))
{
echo '<h2 class="widgettitle">'.$title.'</h2>';
echo '<ul class="twitter">';
foreach($tweets as $tweet)
{
echo '<li>';
if(isset($tweet['text']))
{
echo $tweet['text'];
}
echo '</li>';
}
echo '</ul>';
}
}
echo $after_widget;
}
function update($new_instance, $old_instance) {
$instance = $old_instance;
$instance['twitter_username'] = strip_tags($new_instance['twitter_username']);
$instance['items'] = strip_tags($new_instance['items']);
$instance['title'] = strip_tags($new_instance['title']);
return $instance;
}
function form($instance) {
$instance = wp_parse_args( (array) $instance, array( 'items' => '', 'twitter_username' => '', 'title' => '', 'consumer_key' => '', 'consumer_secret' => '', 'access_token' => '', 'access_token_secret' => '') );
$items = strip_tags($instance['items']);
$items = absint($items);
$twitter_username = strip_tags($instance['twitter_username']);
$title = strip_tags($instance['title']);
?>
<p>
<label for="<?php echo $this->get_field_id('twitter_username'); ?>">Twitter Username: <input class="widefat" id="<?php echo $this->get_field_id('twitter_username'); ?>" name="<?php echo $this->get_field_name('twitter_username'); ?>" type="text" value="<?php echo esc_attr($twitter_username); ?>" /></label>
</p>
<p>
<label for="<?php echo $this->get_field_id('title'); ?>">Title: <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo esc_attr($title); ?>" /></label>
</p>
<p>
<label for="<?php echo $this->get_field_id('items'); ?>">Items (default 5): <input class="widefat" id="<?php echo $this->get_field_id('items'); ?>" name="<?php echo $this->get_field_name('items'); ?>" type="text" value="<?php echo esc_attr($items); ?>" /></label>
</p>
<?php
}
}
register_widget('Custom_Twitter');
/**
* End Twitter Feed Custom Widgets
**/
/**
* Begin Flickr Feed Custom Widgets
**/
class Custom_Flickr extends WP_Widget {
function __construct() {
$widget_ops = array('classname' => 'Custom_Flickr', 'description' => 'Display your recent Flickr photos' );
parent::__construct('Custom_Flickr', 'Custom Flickr', $widget_ops);
}
function widget($args, $instance) {
extract($args, EXTR_SKIP);
echo $before_widget;
$flickr_id = empty($instance['flickr_id']) ? ' ' : apply_filters('widget_title', $instance['flickr_id']);
$title = $instance['title'];
$items = $instance['items'];
if(!is_numeric($items))
{
$items = 9;
}
if(empty($title))
{
$title = 'Flickr Widget';
}
if(!empty($items) && !empty($flickr_id))
{
$photos_arr = get_flickr(array('type' => 'user', 'id' => $flickr_id, 'items' => $items));
if(!empty($photos_arr))
{
echo '<h2 class="widgettitle">'.$title.'</h2>';
echo '<ul class="flickr">';
foreach($photos_arr as $photo)
{
echo '<li>';
echo '<a class="img_frame" href="'.$photo['url'].'" title="'.$photo['title'].'"><img src="'.$photo['thumb_url'].'" alt="" class="frame img_nofade" width="50" height="50"/></a>';
echo '</li>';
}
echo '</ul><br class="clear"/>';
}
}
echo $after_widget;
}
function update($new_instance, $old_instance) {
$instance = $old_instance;
$instance['items'] = absint($new_instance['items']);
$instance['title'] = strip_tags($new_instance['title']);
$instance['flickr_id'] = strip_tags($new_instance['flickr_id']);
return $instance;
}
function form($instance) {
$instance = wp_parse_args( (array) $instance, array( 'items' => '', 'flickr_id' => '', 'title' => '') );
$items = strip_tags($instance['items']);
$flickr_id = strip_tags($instance['flickr_id']);
$title = strip_tags($instance['title']);
?>
<p><label for="<?php echo $this->get_field_id('flickr_id'); ?>">Flickr ID <a href="http://idgettr.com/">Find your Flickr ID here</a>: <input class="widefat" id="<?php echo $this->get_field_id('flickr_id'); ?>" name="<?php echo $this->get_field_name('flickr_id'); ?>" type="text" value="<?php echo esc_attr($flickr_id); ?>" /></label></p>
<p><label for="<?php echo $this->get_field_id('title'); ?>">Title: <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo esc_attr($title); ?>" /></label></p>
<p><label for="<?php echo $this->get_field_id('items'); ?>">Items (default 9): <input class="widefat" id="<?php echo $this->get_field_id('items'); ?>" name="<?php echo $this->get_field_name('items'); ?>" type="text" value="<?php echo esc_attr($items); ?>" /></label></p>
<?php
}
}
register_widget('Custom_Flickr');
/**
* End Flickr Feed Custom Widgets
**/
?> |