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

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

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

		// 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'; }

			echo $args['before_widget'];
			if ( $title ) { echo $args['before_title'] . $title . $args['after_title']; }
			?>
		
			<?php
			global $wp_query;
			if ( $module == 'classic' || $module == 'standard' ||  $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,
					'category_name'		=> $category,
					'post_type' 		=> 'post',
					'post_status'		=> 'publish',
					'orderby'			=> 'date',
					'order'				=> 'DESC',
					'paged' 			=> $paged
				) );
			} else {
				$wp_query = new WP_Query( array( 
					'p'					=> $id,
					'posts_per_page' 	=> $posts_per_page,
					'category_name'		=> $category,
					'post_type' 		=> 'post',
					'post_status'		=> 'publish',
					'orderby'			=> 'date',
					'order'				=> 'DESC'
				) );				
			}
			?>
			
			<?php if ( $module == 'classic' ) : ?>
				
				<?php while ( $wp_query->have_posts() ) : $wp_query->the_post(); ?>
				<!-- begin #post-## -->
				<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>

					<?php if ( has_post_thumbnail() ) : ?>
						<div class="blog-classic clearfix">
					<?php else : ?>
						<div class="blog-classic no-thumbnail clearfix">
					<?php endif; ?>
					
						<!-- begin .entry-header -->
						<header class="entry-header">

							<?php the_title( sprintf( '<h1 class="entry-title"><a href="%s" rel="bookmark">', esc_url( get_permalink() ) ), '</a></h1>' ); ?>

							<?php if ( 'post' == get_post_type() ) : ?>
								<div class="entry-meta">
									<?php aio_posted_on_classic(); ?>
								</div>
							<?php endif; ?>

						</header>
						<!-- end .entry-header -->
					
						<!-- begin .entry-content -->
						<div class="entry-content">

							<?php if ( ( function_exists( 'has_post_thumbnail' ) ) && ( has_post_thumbnail() ) ) : ?>
								<div class="entry-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" 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() ), 280, 260, true, true, true ) ); ?>" width="280" height="260" alt="<?php echo wp_strip_all_tags( get_the_title() ); ?>" />
								</div>
								
								<div class="entry-calendar">
									<span class="meta-day"><?php echo get_the_date('d'); ?></span>
									<span class="meta-month"><?php echo get_the_date('M'); ?></span>
								</div>
							<?php endif; ?>

							<div class="entry-summary">
								<p><?php echo aio_excerpt(28); ?></p>
							</div>

							<?php
							wp_link_pages( array(
								'before' => '<div class="page-links">' . esc_html__( 'Pages:', PLUGIN_NAME ),
								'after'  => '</div>',
							));
							?>

						</div>
						<!-- end .entry-content -->
					
					</div>
					
					<div class="lines"></div>
				</article>
				<!-- end #post-## -->
				<?php endwhile; ?>
				
				<!-- 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 == 'standard' ) : ?>
			
				<?php while ( $wp_query->have_posts() ) : $wp_query->the_post(); ?>
				<!-- begin #post-## -->
				<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
					<div class="blog-standard">

						<!-- begin .entry-header -->
						<header class="entry-header">
						
							<div class="entry-calendar">
								<span class="meta-day"><?php echo get_the_date('d'); ?></span>
								<span class="meta-month"><?php echo get_the_date('M Y'); ?></span>
							</div>

							<?php the_title( sprintf( '<h1 class="entry-title"><a href="%s" rel="bookmark">', esc_url( get_permalink() ) ), '</a></h1>' ); ?>

							<?php if ( 'post' == get_post_type() ) : ?>
								<div class="entry-meta">
									<?php aio_posted_on(); ?>
								</div>
							<?php endif; ?>

						</header>
						<!-- end .entry-header -->
					
						<!-- begin .entry-content -->
						<div class="entry-content">

							<?php if (get_post_format() == 'gallery' ) : ?>
							
								<?php if ( count( vp_metabox( 'post.gallery' ) ) != 0) { ?>
									<div class="entry-gallery">
										<div class="slider-gallery">
											<?php $lists = vp_metabox( 'post.gallery' ); ?>
											<?php foreach ( $lists as $list ) { ?>
												<div class="slider-item">
													<img width="800" height="420" src="<?php echo esc_url( aio_resize( $list['gallery_picture'], 800, 420, true, true, true ) ); ?>" alt="<?php echo esc_attr( $list['gallery_caption'] ); ?>" />
												</div>
											<?php } ?>
										</div>
									</div>
								<?php } ?>
							
							<?php elseif (get_post_format() == 'quote' ) : ?>

								<div class="entry-quote fx-hover">
									<blockquote>
										<p><i class="fa fa-quote-left"></i><?php echo wp_strip_all_tags( vp_metabox( 'post.quote.0.quote_text' ) ); ?><i class="fa fa-quote-right"></i></p>
										<cite><?php echo wp_strip_all_tags( vp_metabox( 'post.quote.0.quote_author' ) ); ?></cite>
									</blockquote>
								</div>
							
							<?php elseif (get_post_format() == 'link' ) : ?>

								<div class="entry-link fx-hover">
									<a href="<?php echo esc_url( vp_metabox( 'post.link.0.link_url' ) ); ?>"><?php echo esc_url( vp_metabox( 'post.link.0.link_url' ) ); ?></a>
								</div>
							
							<?php elseif (get_post_format() == 'video' ) : ?>
							
								<div class="entry-video fx-hover">
									<?php echo vp_metabox( 'post.video.0.video_code' ); ?>
								</div>
								
							<?php elseif (get_post_format() == 'audio' ) : ?>
							
								<div class="entry-audio fx-hover">
									<?php echo vp_metabox( 'post.audio.0.audio_code' ); ?>
								</div>
							
							<?php else : ?>
							
								<?php if ( ( function_exists( 'has_post_thumbnail' ) ) && ( has_post_thumbnail() ) ) : ?>
									<div class="entry-picture 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" 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() ), 800, 420, true, true, true ) ); ?>" width="800" height="420" alt="<?php echo wp_strip_all_tags( get_the_title() ); ?>" />
									</div>
								<?php endif; ?>
								
							<?php endif; ?>

							<div class="entry-summary">
								<?php the_excerpt(); ?>
							</div>

							<?php
							wp_link_pages( array(
								'before' => '<div class="page-links">' . esc_html__( 'Pages:', PLUGIN_NAME ),
								'after'  => '</div>',
							));
							?>

						</div>
						<!-- end .entry-content -->
					
						<!-- begin .entry-footer -->
						<footer class="entry-footer">
							<?php aio_entry_footer(); ?>
						</footer>
						<!-- end .entry-footer -->
						
						<div class="lines"></div>
					
					</div>
				</article>
				<!-- end #post-## -->
				<?php endwhile; ?>
				
				<!-- 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 == 'masonry' ) : ?>
			
				<!-- begin #post-## -->
				<div class="row">
				<div class="blog-mansonry">
				<?php while ( $wp_query->have_posts() ) : $wp_query->the_post(); ?>
					<article class="blog-box column-equal <?php echo wp_strip_all_tags( $column ); ?> <?php echo wp_strip_all_tags( $ani ); ?>" <?php echo wp_strip_all_tags( $animation ); ?>>
						<div class="inner-hover">
						<?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 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_src( get_the_ID() ) ); ?>" 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>
						<div class="blog-meta">
								<span class="blog-meta-author">By <a href="<?php echo get_author_posts_url( get_the_author_meta( 'ID' ) ); ?>"><?php echo get_the_author_meta( 'nickname' ); ?></a>, </span>
							<span class="blog-meta-date">On <?php echo esc_html( get_the_date() ); ?></span>
						</div>
						<p><?php echo aio_excerpt(14); ?></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 == 'box' ) : ?>

				<div class="row row-equal fx">
				<?php while ( $wp_query->have_posts() ) : $wp_query->the_post(); ?>
					<article class="blog-box column-equal <?php echo wp_strip_all_tags( $column ); ?> <?php echo wp_strip_all_tags( $ani ); ?>" <?php echo wp_strip_all_tags( $animation ); ?>>
						<div class="inner-hover">
						<?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 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() ), 600, 340, true, true, true ) ); ?>" width="600" height="340" 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>
						<div class="blog-meta">
								<span class="blog-meta-author">By <a href="<?php echo get_author_posts_url( get_the_author_meta( 'ID' ) ); ?>"><?php echo get_the_author_meta( 'nickname' ); ?></a>, </span>
							<span class="blog-meta-date">On <?php echo esc_html( get_the_date() ); ?></span>
						</div>
						<p><?php echo aio_excerpt(14); ?></p>
						</div>
					</article>
				<?php endwhile; ?>
				</div>
				
			<?php elseif ( $module == 'widget' ) : ?>
				
				<?php while ( $wp_query->have_posts() ) : $wp_query->the_post(); ?>
					<?php if ( ( function_exists( 'has_post_thumbnail' ) ) && ( has_post_thumbnail() ) ) { ?>
						<article class="blog-widget">
							<div class="thumbnail">
								<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 strip_tags( get_the_title() ); ?>" />
							</div>
							<h3><a href="<?php echo get_the_permalink() ?>"><?php echo wp_strip_all_tags( get_the_title() ); ?></a></h3>
							<p><?php echo esc_html( get_the_date() ); ?></p>
						</article>
					<?php } else { ?>
						<article class="blog-widget blog-widget-no-thumb">
							<h3><a href="<?php echo get_the_permalink() ?>"><?php echo wp_strip_all_tags( get_the_title() ); ?></a></h3>
							<p><?php echo esc_html( get_the_date() ); ?></p>
						</article>
					<?php } ?>
				<?php endwhile; ?>
				
			<?php else : ?>
				
				<div class="row row-equal fx">
					<?php while ( $wp_query->have_posts() ) : $wp_query->the_post(); ?>
					<article class="blog-grid column-equal <?php echo wp_strip_all_tags( $column ); ?> <?php echo wp_strip_all_tags( $ani ); ?>" <?php echo wp_strip_all_tags( $animation ); ?>>
						<?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 esc_url( aio_src( get_the_ID() ) ); ?>" data-lightbox="blog" data-title="<?php echo wp_strip_all_tags( get_the_title() ); ?>"><i class="fa fa-plus"></i></a>
								</div>
								<img src="<?php echo esc_url( aio_resize( aio_src( get_the_ID() ), 600, 340, true, true, true ) ); ?>" width="600" height="340" 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 aio_excerpt(15); ?></p>
						<a class="button-medium button-main" href="<?php echo get_the_permalink(); ?>"><?php _e( 'Read More', PLUGIN_NAME ); ?></a>
					</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( 'Blog 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%;" type="text" />
			</p>
			<p>
				<label for="<?php echo $this->get_field_id( 'category' ); ?>"><?php _e( 'Blog 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%;" type="text" />
			</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="widget" <?php if ( $module == 'widget' ) { echo 'selected="selected"'; } ?>>Widget</option>
					<option value="grid" <?php if ( $module == 'grid' ) { echo 'selected="selected"'; } ?>>Grid</option>
					<option value="box" <?php if ( $module == 'box' ) { echo 'selected="selected"'; } ?>>Box</option>
					<option value="standard" <?php if ( $module == 'standard' ) { echo 'selected="selected"'; } ?>>Standard</option>
					<option value="masonry" <?php if ( $module == 'masonry' ) { echo 'selected="selected"'; } ?>>Masonry</option>
					<option value="classic" <?php if ( $module == 'classic' ) { echo 'selected="selected"'; } ?>>Classic</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_blog" );' ) );
}