晋太元中,武陵人捕鱼为业。缘溪行,忘路之远近。忽逢桃花林,夹岸数百步,中无杂树,芳草鲜美,落英缤纷。渔人甚异之,复前行,欲穷其林。 林尽水源,便得一山,山有小口,仿佛若有光。便舍船,从口入。初极狭,才通人。复行数十步,豁然开朗。土地平旷,屋舍俨然,有良田、美池、桑竹之属。阡陌交通,鸡犬相闻。其中往来种作,男女衣着,悉如外人。黄发垂髫,并怡然自乐。 见渔人,乃大惊,问所从来。具答之。便要还家,设酒杀鸡作食。村中闻有此人,咸来问讯。自云先世避秦时乱,率妻子邑人来此绝境,不复出焉,遂与外人间隔。问今是何世,乃不知有汉,无论魏晋。此人一一为具言所闻,皆叹惋。余人各复延至其家,皆出酒食。停数日,辞去。此中人语云:“不足为外人道也。”(间隔 一作:隔绝) 既出,得其船,便扶向路,处处志之。及郡下,诣太守,说如此。太守即遣人随其往,寻向所志,遂迷,不复得路。 南阳刘子骥,高尚士也,闻之,欣然规往。未果,寻病终。后遂无问津者。
| DIR:/home/salvufkx/homedir/www/wp-content/plugins/photo-gallery/admin/views/ |
| Current File : //home/salvufkx/homedir/www/wp-content/plugins/photo-gallery/admin/views/BWGViewWidget.php |
<?php
class BWGViewWidget {
////////////////////////////////////////////////////////////////////////////////////////
// Events //
////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////
// Constants //
////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////
// Variables //
////////////////////////////////////////////////////////////////////////////////////////
private $model;
////////////////////////////////////////////////////////////////////////////////////////
// Constructor & Destructor //
////////////////////////////////////////////////////////////////////////////////////////
public function __construct($model) {
$this->model = $model;
}
////////////////////////////////////////////////////////////////////////////////////////
// Public Methods //
////////////////////////////////////////////////////////////////////////////////////////
public function display() {
}
function widget($args, $instance) {
extract($args);
$title = (isset($instance['title']) ? $instance['title'] : "");
$type = (isset($instance['type']) ? $instance['type'] : "gallery");
$gallery_id = (isset($instance['gallery_id']) ? $instance['gallery_id'] : 0);
$album_id = (isset($instance['album_id']) ? $instance['album_id'] : 0);
$show = (isset($instance['show']) ? $instance['show'] : "random");
$count = (isset($instance['count']) ? $instance['count'] : 4);
$width = (isset($instance['width']) ? $instance['width'] : 100);
$height = (isset($instance['height']) ? $instance['height'] : 100);
$theme_id = (isset($instance['theme_id']) ? $instance['theme_id'] : 0);
// Before widget.
echo $before_widget;
// Title of widget.
if ($title) {
echo $before_title . $title . $after_title;
}
// Widget output.
if ($type == 'gallery') {
require_once(WD_BWG_DIR . '/frontend/controllers/BWGControllerThumbnails.php');
$controller_class = 'BWGControllerThumbnails';
}
else {
require_once(WD_BWG_DIR . '/frontend/controllers/BWGControllerAlbum_compact_preview.php');
$controller_class = 'BWGControllerAlbum_compact_preview';
}
$controller = new $controller_class();
global $bwg;
$params = array (
'from' => 'widget',
'gallery_type' => $type,
'id' => ($type == 'gallery' ? $gallery_id : $album_id),
'show' => $show,
'count' => $count,
'width' => $width,
'height' => $height,
'theme_id' => $theme_id);
$controller->execute($params, 1, $bwg);
$bwg++;
// After widget.
echo $after_widget;
}
// Widget Control Panel.
function form($instance, $id_title, $name_title, $id_type, $name_type, $id_show, $name_show, $id_gallery_id, $name_gallery_id, $id_album_id, $name_album_id, $id_count, $name_count, $id_width, $name_width, $id_height, $name_height, $id_theme_id, $name_theme_id) {
$defaults = array(
'title' => 'Photo Gallery',
'type' => 'gallery',
'gallery_id' => 0,
'album_id' => 0,
'show' => 'random',
'count' => 4,
'width' => 100,
'height' => 100,
'theme_id' => 0,
);
$instance = wp_parse_args((array) $instance, $defaults);
$gallery_rows = $this->model->get_gallery_rows_data();
$album_rows = $this->model->get_album_rows_data();
$theme_rows = $this->model->get_theme_rows_data();
?>
<script>
function bwg_change_type(event, obj) {
var div = jQuery(obj).closest("div");
if (jQuery(jQuery(div).find(".sel_gallery")[0]).prop("checked")) {
jQuery(jQuery(div).find("#p_galleries")).css("display", "");
jQuery(jQuery(div).find("#p_albums")).css("display", "none");
jQuery(obj).nextAll(".bwg_hidden").first().attr("value", "gallery");
}
else {
jQuery(jQuery(div).find("#p_galleries")).css("display", "none");
jQuery(jQuery(div).find("#p_albums")).css("display", "");
jQuery(obj).nextAll(".bwg_hidden").first().attr("value", "album");
}
}
</script>
<p>
<label for="<?php echo $id_title; ?>"><?php _e("Title:", 'bwg_back'); ?></label>
<input class="widefat" id="<?php echo $id_title; ?>" name="<?php echo $name_title; ?>'" type="text" value="<?php echo $instance['title']; ?>"/>
</p>
<p>
<input type="radio" name="<?php echo $name_type; ?>" id="<?php echo $id_type . "_1"; ?>" value="gallery" class="sel_gallery" onclick="bwg_change_type(event, this)" <?php if ($instance['type'] == "gallery") echo 'checked="checked"'; ?> /><label for="<?php echo $id_type . "_1"; ?>"><?php _e("Gallery", 'bwg_back'); ?></label>
<input type="radio" name="<?php echo $name_type; ?>" id="<?php echo $id_type . "_2"; ?>" value="album" class="sel_album" onclick="bwg_change_type(event, this)" <?php if ($instance['type'] == "album") echo 'checked="checked"'; ?> /><label for="<?php echo $id_type . "_2"; ?>"><?php _e("Album", 'bwg_back'); ?></label>
<input type="hidden" name="<?php echo $name_type; ?>" id="<?php echo $id_type; ?>" value="<?php echo $instance['type']; ?>" class="bwg_hidden" />
</p>
<p id="p_galleries" style="display:<?php echo ($instance['type'] == "gallery") ? "" : "none" ?>;">
<select name="<?php echo $name_gallery_id; ?>" id="<?php echo $id_gallery_id; ?>" class="widefat">
<option value="0"><?php _e("Select Gallery", 'bwg_back'); ?></option>
<?php
foreach ($gallery_rows as $gallery_row) {
?>
<option value="<?php echo $gallery_row->id; ?>" <?php echo (($instance['gallery_id'] == $gallery_row->id) ? 'selected="selected"' : ''); ?>><?php echo $gallery_row->name; ?></option>
<?php
}
?>
</select>
</p>
<p id="p_albums" style="display:<?php echo ($instance['type'] == "album") ? "" : "none" ?>;">
<select name="<?php echo $name_album_id; ?>" id="<?php echo $id_album_id; ?>" class="widefat">
<option value="0"><?php _e("Select Album", 'bwg_back'); ?></option>
<?php
foreach ($album_rows as $album_row) {
?>
<option value="<?php echo $album_row->id; ?>" <?php echo (($instance['album_id'] == $album_row->id) ? 'selected="selected"' : ''); ?>><?php echo $album_row->name; ?></option>
<?php
}
?>
</select>
</p>
<p>
<input type="radio" name="<?php echo $name_show; ?>" id="<?php echo $id_show . "_1"; ?>" value="random" <?php if ($instance['show'] == "random") echo 'checked="checked"'; ?> onclick='jQuery(this).nextAll(".bwg_hidden").first().attr("value", "random");' /><label for="<?php echo $id_show . "_1"; ?>"><?php _e("Random", 'bwg_back'); ?></label>
<input type="radio" name="<?php echo $name_show; ?>" id="<?php echo $id_show . "_2"; ?>" value="first" <?php if ($instance['show'] == "first") echo 'checked="checked"'; ?> onclick='jQuery(this).nextAll(".bwg_hidden").first().attr("value", "first");' /><label for="<?php echo $id_show . "_2"; ?>"><?php _e("First", 'bwg_back'); ?></label>
<input type="radio" name="<?php echo $name_show; ?>" id="<?php echo $id_show . "_3"; ?>" value="last" <?php if ($instance['show'] == "last") echo 'checked="checked"'; ?> onclick='jQuery(this).nextAll(".bwg_hidden").first().attr("value", "last");' /><label for="<?php echo $id_show . "_3"; ?>"><?php _e("Last", 'bwg_back'); ?></label>
<input type="hidden" name="<?php echo $name_show; ?>" id="<?php echo $id_show; ?>" value="<?php echo $instance['show']; ?>" class="bwg_hidden" />
</p>
<p>
<label for="<?php echo $id_count; ?>"><?php _e("Count:", 'bwg_back'); ?></label>
<input class="widefat" style="width:25%;" id="<?php echo $id_count; ?>" name="<?php echo $name_count; ?>'" type="text" value="<?php echo $instance['count']; ?>"/>
</p>
<p>
<label for="<?php echo $id_width; ?>"><?php _e("Dimensions:", 'bwg_back'); ?></label>
<input class="widefat" style="width:25%;" id="<?php echo $id_width; ?>" name="<?php echo $name_width; ?>'" type="text" value="<?php echo $instance['width']; ?>"/> x
<input class="widefat" style="width:25%;" id="<?php echo $id_height; ?>" name="<?php echo $name_height; ?>'" type="text" value="<?php echo $instance['height']; ?>"/> px
</p>
<p>
<select name="<?php echo $name_theme_id; ?>" id="<?php echo $id_theme_id; ?>" class="widefat">
<?php
foreach ($theme_rows as $theme_row) {
?>
<option value="<?php echo $theme_row->id; ?>" <?php echo (($instance['theme_id'] == $theme_row->id || $theme_row->default_theme == 1) ? 'selected="selected"' : ''); ?>><?php echo $theme_row->name; ?></option>
<?php
}
?>
</select>
</p>
<?php
}
////////////////////////////////////////////////////////////////////////////////////////
// Getters & Setters //
////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////
// Private Methods //
////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////
// Listeners //
////////////////////////////////////////////////////////////////////////////////////////
} |