<?php
/**
 * Widget Name: AIO Gallerys
 *
 * @package All In One Custom Post
 * @since All In One Custom Post 1.0.0 
 */

if ( ! class_exists( 'vr_widget_gallerys' ) ) {
	class vr_widget_gallerys extends WP_Widget {

		// Widget Construct
		public function __construct() {
			parent::__construct(
				false,
				_x( 'AIO Gallerys' , 'backend', PLUGIN_NAME),
				array(
					'description' => _x( 'Display gallerys custom post.', 'backend', PLUGIN_NAME),
					'classname'   => 'aio-widget-gallerys',
				)
			);
		}

		// Widget Init
		public function widget( $args, $instance ) {
						
			$title			= empty( $instance['title'] ) ? '' : $instance['title'];
			$id 			= empty( $instance['id'] ) ? '' : $instance['id'];
			$category		= empty( $instance['category'] ) ? '' : $instance['category'];
			$posts_per_page	= empty( $instance['posts_per_page'] ) ? '' : $instance['posts_per_page'];
			$module			= empty( $instance['module'] ) ? '' : $instance['module'];
			$column			= empty( $instance['column'] ) ? '' : $instance['column'];
			$animation		= empty( $instance['animation'] ) ? '' : $instance['animation'];
			$ani			= '';

			if ( $animation != '' ) { $animation = 'data-animation="' . $animation . '"'; $ani = 'fx-start'; }
			if ( $module == 'uneven' || $module == 'uneven9' ) { $posts_per_page = 9; }
			if ( $module == 'uneven5' ) { $posts_per_page = 5; }
			if ( $module == 'uneven12' ) { $posts_per_page = 12; }
			if ( $module == 'widget4' ) { $posts_per_page = 4; }
			if ( $module == 'widget6' ) { $posts_per_page = 6; }

			echo $args['before_widget'];
			if ( $title ) { echo $args['before_title'] . $title . $args['after_title']; }
			?>
			
			<?php
			global $wp_query;
			if ( $module == 'sortable' || $module == 'masonry' || $module == 'masonry_brick' ) {
				$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
				$wp_query = new WP_Query( array( 
					'p'					    	=> $id,
					'posts_per_page' 	    	=> $posts_per_page,
					'vr_gallerys_categories'	=> $category,
					'post_type' 		    	=> 'vr_gallerys',
					'post_status'				=> 'publish',
					'orderby'					=> 'date',
					'order'						=> 'DESC',
					'paged' 					=> $paged
				) );
			} else {
				$wp_query = new WP_Query( array( 
					'p'					    	=> $id,
					'posts_per_page' 	    	=> $posts_per_page,
					'vr_gallerys_categories'	=> $category,
					'post_type' 		    	=> 'vr_gallerys',
					'post_status'				=> 'publish',
					'orderby'					=> 'date',
					'order'						=> 'DESC'
				) );
			}
			?>

			<?php if ( $module == 'sortable' ) : ?>
				
				<div class="gallery-sortable clearfix <?php echo sanitize_html_class( $ani ); ?>" <?php echo $animation; ?>>
				
					<div class="gallery-filter">
						<ul>
							<li class="active"><a href="#" data-type="all"><?php _e( 'All', PLUGIN_NAME ); ?></a></li>
							<?php $categories = get_categories( array( 'taxonomy'=> 'vr_gallerys_categories', 'title_li'=>'' ) );
							foreach ( $categories as $category ) {
								if ( $category->name != '' ) {
							?>
									<li><a href="#" data-type="<?php echo $category->slug; ?>"><?php echo $category->name; ?></a></li>
							<?php 
								}
							}
							?>
						</ul>
					</div>

					<?php $i = 1; ?>
					<div class="gallery-list col-md-12">
						<div class="row gallery-row">
						
							<?php 
							while ( $wp_query->have_posts() ) : $wp_query->the_post();

								$terms = get_the_terms( get_the_ID(), 'vr_gallerys_categories' );
								$vr_term_slug;
								$vr_term_name;
								if ( $terms != null  ) {
									foreach ( $terms as $term ) {
										$vr_term_slug =  $term->slug;
										$vr_term_name =  $term->name;
										unset( $term );
									}
								}
							?>

								<article class="gallery-full col-sm-6 <?php echo wp_strip_all_tags( $column ); ?>" data-id="id-<?php echo $i; ?>" data-type="<?php echo wp_strip_all_tags( $vr_term_slug ); ?>">
									<div class="thumbnail fx-hover">
										<div class="fx-hover-back"></div>
										<div class="fx-hover-content">
											<h3><a href="<?php echo get_the_permalink(); ?>"><?php echo wp_strip_all_tags( get_the_title() ); ?></a></h3>
											<p><?php echo wp_strip_all_tags( $vr_term_name ); ?></p>
											<div class="line"></div>
										</div>
										<div class="fx-hover-icon">
											<a class="icon-medium icon-main" href="<?php echo aio_src( get_the_ID() ); ?>" data-lightbox="gallery" data-title="<?php echo wp_strip_all_tags( get_the_title() ); ?>"><i class="fa fa-search"></i></a>
											<a class="icon-medium icon-main" href="<?php echo get_the_permalink(); ?>"><i class="fa fa-link"></i></a>
										</div>
										<img src="<?php echo esc_url( aio_resize( aio_src( get_the_ID() ), 400, 400, true, true, true ) ); ?>" width="400" height="400" alt="<?php echo wp_strip_all_tags( get_the_title() ); ?>" />
									</div>
								</article>
							<?php 
								$i++;
							endwhile;
							?>
						</div>
					</div>

				</div>
				
				<!-- begin .pagination -->
				<nav class="pagination">
					<?php
					echo paginate_links( array(
						'base'               => str_replace( PHP_INT_MAX, '%#%', esc_url( get_pagenum_link( PHP_INT_MAX ) ) ),
						'format'             => '?paged=%#%',
						'current'            => max( 1, get_query_var( 'paged' ) ),
						'total'              => $wp_query->max_num_pages,
						'type'               => 'list',
						'prev_text'	=> __( 'Prev', PLUGIN_NAME ),
						'next_text'	=> __( 'Next', PLUGIN_NAME ),
					));
					?>
				</nav>
				<!-- end .pagination -->
				
			<?php elseif ( $module == 'mansonry' ) : ?>
				
				<div class="row">
				<div class="gallery-mansonry clearfix">
					<?php
					while ( $wp_query->have_posts() ) : $wp_query->the_post();

						$terms = get_the_terms( get_the_ID(), 'vr_gallerys_categories' );
						$vr_term_slug;
						$vr_term_name;
						if ( $terms != null  ) {
							foreach ( $terms as $term ) {
								$vr_term_slug =  $term->slug;
								$vr_term_name =  $term->name;
								unset( $term );
							}
						}
					?>

						<article class="gallery-box <?php echo wp_strip_all_tags( $column ); ?>">
							<div class="inner inner-hover clearfix">
								<?php if ( ( function_exists( 'has_post_thumbnail' ) ) && ( has_post_thumbnail() ) ) : ?>
									<div class="thumbnail fx-hover">
										<div class="fx-hover-back"></div>
										<div class="fx-hover-icon">
											<a class="icon-medium icon-main" href="<?php echo aio_src( get_the_ID() ); ?>" data-lightbox="gallery" data-title="<?php echo wp_strip_all_tags( get_the_title() ); ?>"><i class="fa fa-search"></i></a>
											<a class="icon-medium icon-main" href="<?php echo get_the_permalink(); ?>"><i class="fa fa-link"></i></a>
										</div>
										<img src="<?php echo aio_resize( aio_src( get_the_ID() ), 400, 320, true, true, true ); ?>" width="400" height="320" alt="<?php echo wp_strip_all_tags( get_the_title() ); ?>" />
									</div>
								<?php endif; ?>
								<h3><a href="<?php echo get_the_permalink(); ?>"><?php echo wp_strip_all_tags( get_the_title() ); ?></a></h3>
								<p><?php echo wp_strip_all_tags( $vr_term_name ); ?></p>
							</div>
						</article>

					<?php endwhile; ?>
				</div>
				</div>
				
				<!-- begin .pagination -->
				<nav class="pagination">
					<?php
					echo paginate_links( array(
						'base'               => str_replace( PHP_INT_MAX, '%#%', esc_url( get_pagenum_link( PHP_INT_MAX ) ) ),
						'format'             => '?paged=%#%',
						'current'            => max( 1, get_query_var( 'paged' ) ),
						'total'              => $wp_query->max_num_pages,
						'type'               => 'list',
						'prev_text'	=> __( 'Prev', PLUGIN_NAME ),
						'next_text'	=> __( 'Next', PLUGIN_NAME ),
					));
					?>
				</nav>
				<!-- end .pagination -->

				
			<?php elseif ( $module == 'uneven5' ) : ?>
			
				<?php $num = 1; ?>
				<div class="gallery-unevens clearfix  ">
					<?php while ( $wp_query->have_posts() ) : $wp_query->the_post();

					$terms = get_the_terms( get_the_ID() , 'vr_gallerys_categories' );
					$vr_term_slug;
					$vr_term_name;
					if ( $terms != null  ) {
						foreach ( $terms as $term ) {
							$vr_term_slug = $term->slug;
							$vr_term_name = $term->name;
							unset( $term );
						}
					}
					?>

						<?php 
						echo aio_uneven_5( $num, aio_src( get_the_ID() ), $animation ); 
						$num = $num + 1;
						?>
						<div class="thumbnail fx-hover">
							<div class="fx-hover-back"></div>
							<div class="fx-hover-content">
								<a href="<?php echo get_the_permalink(); ?>"><h3><?php echo wp_strip_all_tags( get_the_title() ); ?></h3></a>
								<p><?php echo wp_strip_all_tags( $vr_term_name ); ?></p>
								<div class="line"></div>
							</div>
							<div class="fx-hover-icon">
								<a class="icon-medium icon-main" href="<?php echo aio_src( get_the_ID() ); ?>" data-lightbox="gallery" data-title="<?php echo wp_strip_all_tags( get_the_title() ); ?>"><i class="fa fa-search"></i></a>
								<a class="icon-medium icon-main" href="<?php echo get_the_permalink(); ?>"><i class="fa fa-link"></i></a>
							</div>
						</div>
					</article>
					
				<?php endwhile; ?>
				</div>
				
			<?php elseif ( $module == 'uneven9' ) : ?>
			
				<?php $num = 1; ?>
				<div class="gallery-unevens clearfix  ">
					<?php while ( $wp_query->have_posts() ) : $wp_query->the_post();

					$terms = get_the_terms( get_the_ID() , 'vr_gallerys_categories' );
					$vr_term_slug;
					$vr_term_name;
					if ( $terms != null  ) {
						foreach ( $terms as $term ) {
							$vr_term_slug = $term->slug;
							$vr_term_name = $term->name;
							unset( $term );
						}
					}
					?>

						<?php 
						echo aio_uneven_9( $num, aio_src( get_the_ID() ), $animation ); 
						$num = $num + 1;
						?>
						<div class="thumbnail fx-hover">
							<div class="fx-hover-back"></div>
							<div class="fx-hover-content">
								<a href="<?php echo get_the_permalink(); ?>"><h3><?php echo wp_strip_all_tags( get_the_title() ); ?></h3></a>
								<p><?php echo wp_strip_all_tags( $vr_term_name ); ?></p><div class="line"></div>
							</div>
							<div class="fx-hover-icon">
								<a class="icon-medium icon-main" href="<?php echo aio_src( get_the_ID() ); ?> " data-lightbox="gallery" data-title="<?php echo wp_strip_all_tags( get_the_title() ); ?>"><i class="fa fa-search"></i></a>
								<a class="icon-medium icon-main" href="<?php echo get_the_permalink(); ?>"><i class="fa fa-link"></i></a>
							</div>
						</div>
					</article>
					
				<?php endwhile; ?>
				</div>
				
			<?php elseif ( $module == 'widget4' ) :  ?>

				<div class="gallery-widget clearfix">
					<?php while ( $wp_query->have_posts() ) : $wp_query->the_post(); ?>
						<article class="gallery-widget-4">
							<div class="thumbnail fx-hover">
								<div class="fx-hover-back"></div>
								<div class="fx-hover-icon">
									<a class="icon-medium icon-main" href="<?php echo esc_url( aio_src( get_the_ID() ) ); ?>" data-lightbox="gallery-widget" data-title="<?php echo wp_strip_all_tags( get_the_title() ); ?>"><i class="fa fa-search"></i></a>
								</div>
								<img src="<?php echo esc_url( aio_resize(aio_src( get_the_ID()), 400, 400, true, true, true) ); ?>" width="400" height="400" alt="<?php echo wp_strip_all_tags( get_the_title() ); ?>" />
							</div>
						</article>
					<?php endwhile; ?>
				</div>

			<?php elseif ( $module == 'widget6' ) :  ?>

				<div class="gallery-widget clearfix">
				<?php while ( $wp_query->have_posts() ) : $wp_query->the_post(); ?>
					<article class="gallery-widget-6">
						<div class="thumbnail fx-hover">
							<div class="fx-hover-back"></div>
							<div class="fx-hover-icon">
								<a class="icon-medium icon-main" href="<?php echo esc_url( aio_src( get_the_ID() ) ); ?>" data-lightbox="gallery-widget" data-title="<?php echo wp_strip_all_tags( get_the_title() ); ?>"><i class="fa fa-search"></i></a>
							</div>
							<img src="<?php echo esc_url( aio_resize(aio_src( get_the_ID()), 400, 400, true, true, true) ); ?>" width="400" height="400" alt="<?php echo wp_strip_all_tags( get_the_title() ); ?>" />
						</div>
					</article>
				<?php endwhile; ?>
				</div>

			<?php else : ?>
				
				<div class="row row-equal row-full fx">
				<?php while ( $wp_query->have_posts() ) : $wp_query->the_post(); ?>
				
					<?php
					$terms = get_the_terms( get_the_ID() , 'vr_gallerys_categories' );
					$vr_term_slug;
					$vr_term_name;
					if ( $terms != null  ) {
						foreach ( $terms as $term ) {
							$vr_term_slug =  $term->slug;
							$vr_term_name =  $term->name;
							unset( $term );
						}
					}
					?>

					<article class="gallery-full column-equal <?php echo wp_strip_all_tags( $column ); ?> <?php echo sanitize_html_class( $ani ); ?>" <?php echo $animation; ?>>
						<div class="thumbnail fx-hover">
							<div class="fx-hover-back"></div>
							<div class="fx-hover-content">
								<a href="<?php echo get_the_permalink(); ?>"><h3><?php echo wp_strip_all_tags( get_the_title() ); ?></h3></a>
								<p><?php echo wp_strip_all_tags( $vr_term_name ); ?></p>
								<div class="line"></div>
							</div>
							<div class="fx-hover-icon">
								<a class="icon-medium icon-main" href="<?php echo esc_url( aio_src( get_the_ID() ) ); ?>" data-lightbox="gallery" data-title="<?php echo wp_strip_all_tags( get_the_title() ); ?>"><i class="fa fa-search"></i></a>
								<a class="icon-medium icon-main" href="<?php echo get_the_permalink(); ?>"><i class="fa fa-link"></i></a>
							</div>
							<img src="<?php echo esc_url( aio_resize( aio_src( get_the_ID() ), 400, 400, true, true, true ) ); ?>" width="400" height="400" alt="<?php echo wp_strip_all_tags( get_the_title() ); ?>" />
						</div>
					</article>
				
				<?php endwhile; ?>
				</div>

			<?php endif; ?>

			<?php wp_reset_query(); ?>
		
			<?php
			echo $args['after_widget'];
		}

		// Form Update
		public function update( $new_instance, $old_instance ) {
			$instance = array();

			$instance['title'] 				= wp_strip_all_tags( $new_instance['title'] );
			$instance['id'] 				= esc_attr( $new_instance['id'] );	
			$instance['category'] 			= esc_attr( $new_instance['category'] );
			$instance['posts_per_page'] 	= esc_attr( $new_instance['posts_per_page'] );
			$instance['module'] 			= esc_attr( $new_instance['module'] );
			$instance['column'] 			= esc_attr( $new_instance['column'] );
			$instance['animation'] 			= esc_attr( $new_instance['animation'] );

			return $instance;
		}

		// Widget Form
		public function form( $instance ) {

			$title			= empty( $instance['title'] ) ? '' : $instance['title'];
			$id 			= empty( $instance['id'] ) ? '' : $instance['id'];
			$category		= empty( $instance['category'] ) ? '' : $instance['category'];
			$posts_per_page	= empty( $instance['posts_per_page'] ) ? '-1' : $instance['posts_per_page'];
			$module			= empty( $instance['module'] ) ? 'grid' : $instance['module'];
			$column			= empty( $instance['column'] ) ? 'col-md-3' : $instance['column'];
			$animation		= empty( $instance['animation'] ) ? '' : $instance['animation'];
			
			?>

			<p>
				<label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e( 'Widget Title :', PLUGIN_NAME ); ?></label>
				<input id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" value="<?php echo 
wp_strip_all_tags( $title ); ?>" style="width:100%;" type="text" />
			</p>
			<p>
				<label for="<?php echo $this->get_field_id( 'id' ); ?>"><?php _e( 'Gallery Id :', PLUGIN_NAME ); ?></label>
				<input id="<?php echo $this->get_field_id( 'id' ); ?>" name="<?php echo $this->get_field_name( 'id' ); ?>" value="<?php echo esc_attr( $id ); ?>" style="width:100%;" />
			</p>
			<p>
				<label for="<?php echo $this->get_field_id( 'category' ); ?>"><?php _e( 'Gallery Category :', PLUGIN_NAME ); ?></label>
				<input id="<?php echo $this->get_field_id( 'category' ); ?>" name="<?php echo $this->get_field_name( 'category' ); ?>" value="<?php echo esc_attr( $category ); ?>" style="width:100%;" />
			</p>
			<p>
				<label for="<?php echo $this->get_field_id( 'posts_per_page' ); ?>"><?php _e( 'Posts Per Page :', PLUGIN_NAME ); ?></label>
				<input id="<?php echo $this->get_field_id( 'posts_per_page' ); ?>" name="<?php echo $this->get_field_name( 'posts_per_page' ); ?>" value="<?php echo absint( $posts_per_page ); ?>" style="width:100%;" type="number" step="1" min="-1" max="" value="-1"/>
			</p>
			<p>
				<label for="<?php echo $this->get_field_id( 'module' ); ?>"><?php _e( 'Module :', PLUGIN_NAME ); ?></label>
				<select id="<?php echo $this->get_field_id( 'module' ); ?>" name="<?php echo $this->get_field_name( 'module' ); ?>" style="width:100%;">
				<option value="widget4" <?php if ( $module == 'widget4' ) { echo 'selected="selected"'; } ?>>Widget 4</option>
				<option value="widget6" <?php if ( $module == 'widget6' ) { echo 'selected="selected"'; } ?>>Widget 6</option>
				<option value="grid" <?php if ( $module == 'grid' ) { echo 'selected="selected"'; } ?>>Grid</option>
				<option value="sortable" <?php if ( $module == 'sortable' ) { echo 'selected="selected"'; } ?>>Sortable</option>
				<option value="mansonry" <?php if ( $module == 'mansonry' ) { echo 'selected="selected"'; } ?>>Mansonry</option>
				<option value="uneven5" <?php if ( $module == 'uneven5' ) { echo 'selected="selected"'; } ?>>Uneven 5</option>
				<option value="uneven9" <?php if ( $module == 'uneven9' ) { echo 'selected="selected"'; } ?>>Uneven 9</option>
				</select>
			</p>
			<p>
				<label for="<?php echo $this->get_field_id( 'column' ); ?>"><?php _e( 'Column :', PLUGIN_NAME ); ?></label>
				<select id="<?php echo $this->get_field_id( 'column' ); ?>" name="<?php echo $this->get_field_name( 'column' ); ?>" style="width:100%;">
					<option value="col-md-1" <?php if ( $column == 'col-md-1' ) { echo 'selected="selected"'; } ?>>1</option>
					<option value="col-md-2" <?php if ( $column == 'col-md-2' ) { echo 'selected="selected"'; } ?>>2</option>
					<option value="col-sm-6 col-md-2" <?php if ( $column == 'col-sm-6 col-md-2' ) { echo 'selected="selected"'; } ?>>2-6</option>
					<option value="col-md-3" <?php if ( $column == 'col-md-3' ) { echo 'selected="selected"'; } ?>>3</option>
					<option value="col-sm-6 col-md-3" <?php if ( $column == 'col-sm-6 col-md-3' ) { echo 'selected="selected"'; } ?>>3-6</option>
					<option value="col-md-4" <?php if ( $column == 'col-md-4' ) { echo 'selected="selected"'; } ?>>4</option>
					<option value="col-sm-6 col-md-4" <?php if ( $column == 'col-sm-6 col-md-4' ) { echo 'selected="selected"'; } ?>>4-6</option>
					<option value="col-md-5" <?php if ( $column == 'col-md-5' ) { echo 'selected="selected"'; } ?>>5</option>
					<option value="col-md-6" <?php if ( $column == 'col-md-6' ) { echo 'selected="selected"'; } ?>>6</option>
					<option value="col-sm-6 col-md-6" <?php if ( $column == 'col-sm-6 col-md-6' ) { echo 'selected="selected"'; } ?>>6-6</option>
					<option value="col-md-7" <?php if ( $column == 'col-md-7' ) { echo 'selected="selected"'; } ?>>7</option>
					<option value="col-md-8" <?php if ( $column == 'col-md-8' ) { echo 'selected="selected"'; } ?>>8</option>
					<option value="col-md-9" <?php if ( $column == 'col-md-9' ) { echo 'selected="selected"'; } ?>>9</option>
					<option value="col-md-10" <?php if ( $column == 'col-md-10' ) { echo 'selected="selected"'; } ?>>10</option>
					<option value="col-md-11" <?php if ( $column == 'col-md-11' ) { echo 'selected="selected"'; } ?>>11</option>	
					<option value="col-md-12" <?php if ( $column == 'col-md-12' ) { echo 'selected="selected"'; } ?>>12</option>					
				</select>
			</p>
			<p>
				<label for="<?php echo $this->get_field_id( 'animation' ); ?>"><?php _e( 'Animation :', PLUGIN_NAME ); ?></label>
				<select id="<?php echo $this->get_field_id( 'animation' ); ?>" name="<?php echo $this->get_field_name( 'animation' ); ?>" style="width:100%;">
					<option value="" <?php if ( $animation == '' ) { echo 'selected="selected"'; } ?>>None</option>
					<option value="fadeIn" <?php if ( $animation == 'fadeIn' ) { echo 'selected="selected"'; } ?>>fadeIn</option>
					<option value="fadeInUp" <?php if ( $animation == 'fadeInUp' ) { echo 'selected="selected"'; } ?>>fadeInUp</option>
					<option value="fadeInDown" <?php if ( $animation == 'fadeInDown' ) { echo 'selected="selected"'; } ?>>fadeInDown</option>
					<option value="fadeInLeft" <?php if ( $animation == 'fadeInLeft' ) { echo 'selected="selected"'; } ?>>fadeInLeft</option>
					<option value="fadeInRight" <?php if ( $animation == 'fadeInRight' ) { echo 'selected="selected"'; } ?>>fadeInRight</option>
					<option value="rotateFromLeft" <?php if ( $animation == 'rotateFromLeft' ) { echo 'selected="selected"'; } ?>>rotateFromLeft</option>
					<option value="rotateFromRight" <?php if ( $animation == 'rotateFromRight' ) { echo 'selected="selected"'; } ?>>rotateFromRight</option>
					<option value="flipInX" <?php if ( $animation == 'flipInX' ) { echo 'selected="selected"'; } ?>>flipInX</option>
					<option value="flipOutX" <?php if ( $animation == 'flipOutX' ) { echo 'selected="selected"'; } ?>>flipOutX</option>
					<option value="flipInY" <?php if ( $animation == 'flipInY' ) { echo 'selected="selected"'; } ?>>flipInY</option>
					<option value="flipOutY" <?php if ( $animation == 'flipOutY' ) { echo 'selected="selected"'; } ?>>flipOutY</option>
					<option value="bounceIn" <?php if ( $animation == 'bounceIn' ) { echo 'selected="selected"'; } ?>>zoomIn</option>
					<option value="bounceInUp" <?php if ( $animation == 'bounceInUp' ) { echo 'selected="selected"'; } ?>>bounceInUp</option>
					<option value="bounceInDown" <?php if ( $animation == 'bounceInDown' ) { echo 'selected="selected"'; } ?>>bounceInDown</option>
					<option value="bounceInLeft" <?php if ( $animation == 'bounceInLeft' ) { echo 'selected="selected"'; } ?>>bounceInLeft</option>
					<option value="bounceInRight" <?php if ( $animation == 'bounceInRight' ) { echo 'selected="selected"'; } ?>>bounceInRight</option>
				</select>
			</p>

			<?php
		}

	}
	add_action( 'widgets_init', create_function( '', 'register_widget( "vr_widget_gallerys" );' ) );
}