<?
/*
Plugin Name: Newstastic Vertical and Horizontal Post Slider 
Plugin URI: http://www.moduswebsupport.com
Description: This little widget will display your posts from all or selected categories in a horizonal or vertical format, you can select a few options on what you'd like to show and set the width, height etc. This is a first release so we welcome feedback. If you'd like us to customise it for your site, let us know. TIP! On some servers you may need to reset the permissions of the cache folder;)
Version: 1.0.6
Author: Modus IT
Author URI: http://www.modus.ie
*/





add_action('init', 'ns_add_script_fn');
function ns_add_script_fn(){
$config = get_option('ds_config'); 

   if(!is_admin()){

  // Jquery slider
  wp_enqueue_script('j_tools_js',  plugins_url('/js/scroller.js', __FILE__ ), array( 'jquery' ), '1.0' ) ;

  // main JS and CSS
  wp_enqueue_script('main_js', plugins_url('/js/front.js', __FILE__ ), array( 'jquery' ), '1.0' ) ;
  wp_enqueue_style('main_css', plugins_url('/css/front.css', __FILE__ ) );
  }else{
    wp_enqueue_script('ds_admin_js', plugins_url('/js/admin.js', __FILE__ ), array( 'jquery' ), '1.0' ) ;
   wp_enqueue_style('ds_admin_css', plugins_url('/css/admin.css', __FILE__ ) );
   
   }
}

add_shortcode('show_slider', 'show_slider');
function show_slider(){
$config = get_option('ds_config'); 
?>


<?php 
}


/**
 * Foo_Widget Class
 */
class news_slider extends WP_Widget {
	/** constructor */
	function __construct() {
		parent::WP_Widget( /* Base ID */'news_slider', /* Name */'News Slider', array( 'description' => 'News Slider' ) );
	}

	function use_scripts(){
		echo '!!!';
	}
	
	/** @see WP_Widget::widget */
	function widget( $args, $instance ) {
		extract( $args );
		$title = apply_filters( 'widget_title', $instance['title'] );
		
		
		
		$args = array(
    'show_option_all'    => 'All' ,
    'orderby'            => 'ID', 
    'order'              => 'ASC',
    'show_count'         => 0,
    'hide_empty'         => 0, 
    'child_of'           => 0,
    'echo'               => 0,
    'selected'           => $cat,
    'hierarchical'       => 0, 
    'name'               => $this->get_field_name('cat'),
    'class'              => 'postform',
    'depth'              => 0,
    'tab_index'          => 0,
    'taxonomy'           => 'category',
    'hide_if_empty'      => false ); ?>
          <?php $cat_objects = get_categories( $args );		  ?>
          <?php 
		  $cat[] = apply_filters( 'widget_title', $instance['all'] );	  
		  $cat['all'] = 	esc_attr( $instance[ 'all' ] );
		  foreach($cat_objects as $cat_objects_out){
				$cat[] = apply_filters( 'widget_title', $instance[$cat_objects_out->slug] );	  
		  }
		
		$sl_width = apply_filters( 'widget_title', $instance['sl_width'] );
		$sl_height = apply_filters( 'widget_title', $instance['sl_height'] );
		$thumb_width = apply_filters( 'widget_title', $instance['thumb_width'] );
		$thumb_hight = apply_filters( 'widget_title', $instance['thumb_hight'] );
		$image_align = apply_filters( 'widget_title', $instance['image_align'] );
		$post_num = apply_filters( 'widget_title', $instance['post_num'] );
		$post_show = apply_filters( 'widget_title', $instance['post_show'] );
		$slider_align = apply_filters( 'widget_title', $instance['slider_align'] );
		$show_title = apply_filters( 'widget_title', $instance['show_title'] );
		$show_content = apply_filters( 'widget_title', $instance['show_content'] );
		$show_author = apply_filters( 'widget_title', $instance['show_author'] );
		$show_date = apply_filters( 'widget_title', $instance['show_date'] );
		$cont_max = apply_filters( 'widget_title', $instance['cont_max'] );
		$title_max = apply_filters( 'widget_title', $instance['title_max'] );
		$ef_speed = apply_filters( 'widget_title', $instance['ef_speed'] );
		
		
		 if( $slider_align == 'hor' ){
		 echo '<link rel="stylesheet" type="text/css" media="all" href="'.plugins_url('/css/hor.css', __FILE__ ).'" />';
		 echo '<link rel="stylesheet" type="text/css" media="all" href="'.plugins_url('/css/button.css', __FILE__ ).'" />';
		 echo '<link rel="stylesheet" type="text/css" media="all" href="'.plugins_url('/css/nav.css', __FILE__ ).'" />';

  		}else{
				echo '<link rel="stylesheet" type="text/css" media="all" href="'.plugins_url('/css/vert.css', __FILE__ ).'" />';
		}
		
		add_action(  'init', 'use_scripts' );
		
		echo $before_widget;
		if ( !empty( $title ) ) { echo $before_title . $title . $after_title; } 

		?>
		
		
		

<?php if( $slider_align == 'hor' ): ?>

<div class="nav_block">
		<div class="navi"></div>

		<div id="actions">
			<a class="next">next</a>
		   <a class="prev">previous</a>   
		</div>
		<div class="clearfix"></div>
</div>
<div class="scrollable" id=browsable>     
   <div class="items">
   
   <?php

   
   if( in_array('all', $cat) ){
   $all_posts = get_posts( 'showposts='.$post_num );
   }   
   else{
   $cat_slugs = implode(',', $cat);
   $all_posts = get_posts( 'showposts='.$post_num.'&category_name='.$cat_slugs );
   }
   
   
   $total_index = 0;  
   $total_count = count( $all_posts );
   
   $block_count = $total_count / (int)$post_show;
   
   if( $total_count % (int)$post_show != 0 ){
		$block_count = floor($block_count) + 1;
   }else{
		$block_count = floor($block_count);
   }
      
   for($k=1; $k <= (int)$block_count ; $k++){
	  ?>
	  <div class="in_div">
		<?php for( $j=1; $j <= (int)$post_show; $j++ ) :?>
		
		<?php if( !$all_posts[ $total_index ] )  break; ?>
			<?php $cur_item = $all_posts[ $total_index ]; $total_index++; ?>
			<div class="over_div <?php if( $j != 1 ) echo ' br_r '; ?>">
			 <div class="post_cont <?php if( $image_align == 'left' ) echo ' fl_r '; else echo ' fl_l '; ?>"> 
				<div class="p_title"><a href="<?php echo get_permalink($cur_item->ID); ?>">
				<?php $out_cont = substr($cur_item->post_title, 0, (int)$title_max -3 ); 
					if( $show_title == 'on' ) echo $out_cont; ?>	
				</a></div>
				<div class="p_meta"><?php $user_info = get_userdata( $cur_item->post_author ); if( $show_author == 'on' ) echo $user_info->user_login ?> <?php $cur = strtotime( $cur_item->post_date ); if( $show_date == 'on' ) echo date( 'Y-m-d H:i', $cur ); ?></div>

				<div class="p_content"><?php $out_cont = substr( strip_tags( $cur_item->post_content ), 0, (int)$cont_max -3 ); if( $show_content == 'on' ) echo $out_cont.' ...'; ?></div>
			 </div>
			 <img class="<?php if( $image_align == 'left' ) echo ' fl_l '; else echo ' fl_r '; ?>" src="<?php 
			 $src = wp_get_attachment_image_src(get_post_thumbnail_id($cur_item->ID), 'thumbnail');

			 $files = get_children('post_parent='.$cur_item->ID.'&post_type=attachment&post_mime_type=image');
			 $this_image = null;
			 $first = 0;
			 foreach( $files as $files_out ){
			 	if( $first == 0 ){
				$this_image = $files_out;
				$first++;
				}
			 }
			 
			 if( $src[0] )
				echo plugins_url('/inc/timthumb.php', __FILE__).'?src='.$src[0].'&w='.$thumb_width.'&h='.$thumb_hight;
			 elseif( $this_image->guid  )
			 echo plugins_url('/inc/timthumb.php', __FILE__).'?src='.$this_image->guid.'&w='.$thumb_width.'&h='.$thumb_hight;
			 
			 else
			 echo plugins_url('/inc/timthumb.php', __FILE__).'?src='.plugins_url('/images/no_image.jpg', __FILE__).'&w='.$thumb_width.'&h='.$thumb_hight;
			 
			 
			 ?>" />
			
		 </div>
	  
		<?php endfor; ?>
		
	  </div>	  
	  <?php
	}
   ?>
     
    
   </div>
  <div class="clearfix" ></div>
</div>
<br clear="all" />
<!-- This styles -->
<?php

$width = (int)$sl_width;
$block_width = ($width / $post_show) -2;
//
$image_width_2count = (int)$thumb_width + 20;
$content_width = $block_width - $image_width_2count -30 ;

echo '
<style>
.post_cont {
width:'.$content_width.'px;

}

.over_div {
	width: '.$block_width.'px;
}
.nav_block{
	width: '.$width.'px;
}
.scrollable {
	width: '.$width.'px;
	height:'.$sl_height.'px;
	/* padding: 10px; */
}
.items .in_div {
	width:'.$width.'px;
}
</style>

<script>
// execute your scripts when the DOM is ready. this is mostly a good habit
$(function() {

	// initialize scrollable
	$("#browsable").scrollable({ speed: '.$ef_speed.'}).navigator();  

});
</script>

';
?>
<?php endif; ?>


<?php if( $slider_align == 'vert' ): ?>

<div class="navi"></div>
<div id="actions">
	<a class="next">next</a>
   <a class="prev">previous</a>
   
</div>

<!-- root element for scrollable -->
<div class="scrollable vertical">

   <!-- root element for the scrollable elements -->
   <div class="items">

      <?php
   if( in_array('all', $cat) ){
   $all_posts = get_posts( 'showposts='.$post_num );
   }   
   else{
   $cat_slugs = implode(',', $cat);
   $all_posts = get_posts( 'showposts='.$post_num.'&category_name='.$cat_slugs );
   }
   
   
   $total_index = 0;  
   $total_count = count( $all_posts );
   
   $block_count = $total_count / (int)$post_show;
   
   if( $total_count % (int)$post_show != 0 ){
		$block_count = floor($block_count) + 1;
   }else{
		$block_count = floor($block_count);
   }
      
   for($k=1; $k <= (int)$block_count ; $k++){
	  ?>
	  <div class="in_div">
		<?php for( $j=1; $j <= (int)$post_show; $j++ ) :?>
		
		<?php if( !$all_posts[ $total_index ] )  break; ?>
			<?php $cur_item = $all_posts[ $total_index ]; $total_index++; ?>
			<div class="over_div">
			 <div class="post_cont <?php if( $image_align == 'left' ) echo ' fl_r '; else echo ' fl_l '; ?>"> 
				<div class="p_title"><a href="<?php echo get_permalink($cur_item->ID); ?>">
				<?php $out_cont = substr($cur_item->post_title, 0, (int)$title_max -3 ); 
					if( $show_title == 'on' ) echo $out_cont; ?>	
				</a></div>
				<div class="p_meta"><?php $user_info = get_userdata( $cur_item->post_author ); if( $show_author == 'on' ) echo $user_info->user_login ?> <?php $cur = strtotime( $cur_item->post_date ); if( $show_date == 'on' ) echo date( 'Y-m-d H:i', $cur ); ?></div>

				<div class="p_content"><?php $out_cont = substr( strip_tags(  $cur_item->post_content ), 0, (int)$cont_max -3 ); if( $show_content == 'on' ) echo $out_cont.' ...'; ?></div>
			 </div>
			 <img class="mar_10 <?php if( $image_align == 'left' ) echo ' fl_l '; else echo ' fl_r '; ?>" src="<?php 
			 $src = wp_get_attachment_image_src(get_post_thumbnail_id($cur_item->ID), 'thumbnail');
			 
			 $files = get_children('post_parent='.$cur_item->ID.'&post_type=attachment&post_mime_type=image');
			 $this_image = null;
			 $first = 0;
			 foreach( $files as $files_out ){
			 	if( $first == 0 ){
				$this_image = $files_out;
				$first++;
				}
			 }
			 
			 
			 //var_dump( $this_image );
			 if( $src[0] )
				echo plugins_url('/inc/timthumb.php', __FILE__).'?src='.$src[0].'&w='.$thumb_width.'&h='.$thumb_hight;
			 elseif( $this_image->guid  )
			 echo plugins_url('/inc/timthumb.php', __FILE__).'?src='.$this_image->guid.'&w='.$thumb_width.'&h='.$thumb_hight;
			 
			 else
			 echo plugins_url('/inc/timthumb.php', __FILE__).'?src='.plugins_url('/images/no_image.jpg', __FILE__).'&w='.$thumb_width.'&h='.$thumb_hight;
			 
			 
			 ?>" />
			 <div class="clearfix"></div>
		 </div>
	  
		<?php endfor; ?>
	  </div>	  
	  <?php
	}
   ?>
      

   </div>

</div>
<br clear="all" />
<style>



<?php 
$height_block = $sl_height; 
$width_block = $sl_width;

$image_width_2count = (int)$thumb_width + 20;
$content_width = $width_block - $image_width_2count -20 ;


$in_div_height = ($height_block / $post_show) -2;
?>
.vertical {  
	height: <?php echo $height_block ; ?>px;
	width: <?php echo $width_block ; ?>px;	
	}
#actions {
	width: <?php echo $width_block ; ?>px;	
}	

.post_cont {
width:<?php echo $content_width ; ?>px;
}

.over_div {
	height: <?php echo $in_div_height ; ?>px;
}

</style>
<script>
$(function() {
	$(".scrollable").scrollable({ vertical: true, speed: <?php echo $ef_speed; ?>, mousewheel: true }).navigator(".navi");
});
</script>

<?php endif; ?>
		
		
		
		<?php echo $after_widget;
}
	function update( $new_instance, $old_instance ) {
		$instance = $old_instance;

			$args = array(
    'show_option_all'    => 'All' ,
    'orderby'            => 'ID', 
    'order'              => 'ASC',
    'show_count'         => 0,
    'hide_empty'         => 0, 
    'child_of'           => 0,
    'echo'               => 0,
    'selected'           => $cat,
    'hierarchical'       => 0, 
    'name'               => $this->get_field_name('cat'),
    'class'              => 'postform',
    'depth'              => 0,
    'tab_index'          => 0,
    'taxonomy'           => 'category',
    'hide_if_empty'      => false ); ?>
          <?php $cat_objects = get_categories( $args );		  ?>
          <?php 
		  $instance['all'] = strip_tags($new_instance['all']);
		  foreach($cat_objects as $cat_objects_out){
				//$cat[$cat_objects_out->slug] = 	esc_attr( $instance[ $cat_objects_out->slug ] );
				$instance[$cat_objects_out->slug] = strip_tags($new_instance[$cat_objects_out->slug]);				
		  }
			
			
			$instance['sl_width'] = strip_tags($new_instance['sl_width']);
			$instance['sl_height'] = strip_tags($new_instance['sl_height']);
			$instance['thumb_width'] = strip_tags($new_instance['thumb_width']);
			$instance['thumb_hight'] = strip_tags($new_instance['thumb_hight']);
			$instance['image_align'] = strip_tags($new_instance['image_align']);
			$instance['post_num'] = strip_tags($new_instance['post_num']);
			$instance['post_show'] = strip_tags($new_instance['post_show']);
			$instance['slider_align'] = strip_tags($new_instance['slider_align']);
			$instance['show_title'] = strip_tags($new_instance['show_title']);
			$instance['show_content'] = strip_tags($new_instance['show_content']);
			$instance['show_author'] = strip_tags($new_instance['show_author']);
			$instance['show_date'] = strip_tags($new_instance['show_date']);
			$instance['cont_max'] = strip_tags($new_instance['cont_max']);
			$instance['title_max'] = strip_tags($new_instance['title_max']);
			$instance['ef_speed'] = strip_tags($new_instance['ef_speed']);
		
		$instance['title'] = strip_tags($new_instance['title']);
		return $instance;
	}

	function form( $instance ) {
		if ( $instance ) {
		
		
		
	$args = array(
    'show_option_all'    => 'All' ,
    'orderby'            => 'ID', 
    'order'              => 'ASC',
    'show_count'         => 0,
    'hide_empty'         => 0, 
    'child_of'           => 0,
    'echo'               => 0,
    'selected'           => $cat,
    'hierarchical'       => 0, 
    'name'               => $this->get_field_name('cat'),
    'class'              => 'postform',
    'depth'              => 0,
    'tab_index'          => 0,
    'taxonomy'           => 'category',
    'hide_if_empty'      => false ); ?>
          <?php $cat_objects = get_categories( $args );		  ?>
          <?php 
		  $cat['all'] = 	esc_attr( $instance[ 'all' ] );
		  foreach($cat_objects as $cat_objects_out){
				$cat[$cat_objects_out->slug] = 	esc_attr( $instance[ $cat_objects_out->slug ] );	  
		  }
		  
		
		
			$title = esc_attr( $instance[ 'title' ] );		
			
			$sl_width = esc_attr( $instance[ 'sl_width' ] );
			$sl_height = esc_attr( $instance[ 'sl_height' ] );
			$thumb_width = esc_attr( $instance[ 'thumb_width' ] );
			$thumb_hight = esc_attr( $instance[ 'thumb_hight' ] );
			$image_align = esc_attr( $instance[ 'image_align' ] );
			$post_num = esc_attr( $instance[ 'post_num' ] );
			$post_show = esc_attr( $instance[ 'post_show' ] );
			$slider_align = esc_attr( $instance[ 'slider_align' ] );
			$show_title = esc_attr( $instance[ 'show_title' ] );
			$show_content = esc_attr( $instance[ 'show_content' ] );
			$show_author = esc_attr( $instance[ 'show_author' ] );
			$show_date = esc_attr( $instance[ 'show_date' ] );
			$cont_max = esc_attr( $instance[ 'cont_max' ] );
			$title_max = esc_attr( $instance[ 'title_max' ] );
			$ef_speed = esc_attr( $instance[ 'ef_speed' ] );
			
		}
		else {
			$title = __( 'New title', 'text_domain' );
			
			$cat['all'] = 'all';
			$sl_width = 900;
			$sl_height = 120;
			$thumb_width = 100;
			$thumb_hight = 100;
			$image_align = 'left';
			$post_num = 5;
			$post_show = 3;
			$slider_align = 'hor';
			$show_title = 'on';
			$show_content = 'on';
			$show_author = 'on';
			$show_date = 'on';
			$cont_max = 100;
			$title_max = 100;
			$ef_speed = 300;

		}
		?>
		<?php //var_dump( $cat ) ; ?>
<p>
		<label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:'); ?></label> 
		<input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo $title; ?>" />
		</p>
		
		<table class="form-table">
    
	
	<tr valign="top">
        <th scope="row"><?php _e('Category'); ?></th>
        <td>
		<?php $args = array(
    'show_option_all'    => 'All' ,
    'orderby'            => 'ID', 
    'order'              => 'ASC',
    'show_count'         => 0,
    'hide_empty'         => 0, 
    'child_of'           => 0,
    'echo'               => 0,
    'selected'           => $cat,
    'hierarchical'       => 0, 
    'name'               => $this->get_field_name('cat'),
    'class'              => 'postform',
    'depth'              => 0,
    'tab_index'          => 0,
    'taxonomy'           => 'category',
    'hide_if_empty'      => false ); ?>
          <?php $cat_objects = get_categories( $args );		  ?>
		  <input type="checkbox" name="<?php echo $this->get_field_name('all'); ?>" value="all" <?php if( $cat['all'] == 'all' ) echo ' checked ';  ?> />All<br/>
          <?php foreach($cat_objects as $cat_objects_out): ?>	 
		  <input type="checkbox" name="<?php echo $this->get_field_name( $cat_objects_out->slug ); ?>" value="<?php echo $cat_objects_out->slug; ?>" <?php if( $cat[$cat_objects_out->slug] == $cat_objects_out->slug ) echo ' checked ';  ?>  /><?php echo $cat_objects_out->name; ?><br/>
		  <?php endforeach; ?>
 
        </td>
    </tr>
	
	<tr valign="top">
        <th scope="row"><?php _e('Slider Width'); ?></th>
        <td>
          
          <input type="text"  name="<?php echo $this->get_field_name('sl_width'); ?>"  value="<?php echo $sl_width; ?>" />		 
 
        </td>
    </tr>
	
	<tr valign="top">
        <th scope="row"><?php _e('Slider Height'); ?></th>
        <td>
          
          <input type="text"  name="<?php echo $this->get_field_name('sl_height'); ?>"  value="<?php echo $sl_height; ?>" />		 
 
        </td>
    </tr>
	
	<tr valign="top">
        <th scope="row"><?php _e('Image size ?'); ?></th>
        <td>
          
          <input type="text" id="<?php echo $this->get_field_id('thumb_width'); ?>" name="<?php echo $this->get_field_name('thumb_width'); ?>"  value="<?php echo $thumb_width; ?>" />x
		  <input type="text"  name="<?php echo $this->get_field_name('thumb_hight'); ?>"  value="<?php echo $thumb_hight; ?>" />

          <p><?php _e('Images width x height.'); ?> </p>
        </td>
    </tr>
	
	
	 <tr valign="top">
        <th scope="row"><?php _e('Image Align'); ?></th>
        <td>
           <select name="<?php echo $this->get_field_name('image_align'); ?>">
          <option value="left" <?php if( $image_align == 'left' ) echo ' selected '; ?> >Left
		  <option value="right" <?php if( $image_align == 'right' ) echo ' selected '; ?> >Right
		  </select>	 
          
    </tr>
	
	 <tr valign="top">
        <th scope="row"><?php _e('Post Number'); ?></th>
        <td>
          
          <input type="text"  name="<?php echo $this->get_field_name('post_num'); ?>"  value="<?php echo $post_num; ?>" />		 
         
        </td>
    </tr>
	
	<tr valign="top">
        <th scope="row"><?php _e('Post Number To show at once'); ?></th>
        <td>
          
          <input type="text"  name="<?php echo $this->get_field_name('post_show'); ?>"  value="<?php echo $post_show; ?>" />		 
 
        </td>
    </tr>
	
	<tr valign="top">
        <th scope="row"><?php _e('Slider Orientation'); ?></th>
        <td>
          <select name="<?php echo $this->get_field_name('slider_align'); ?>">
          <option value="hor" <?php if( $slider_align == 'hor' ) echo ' selected '; ?> >Horizontal
		  <option value="vert" <?php if( $slider_align == 'vert' ) echo ' selected '; ?> >Vertical
		  </select>

        </td>
    </tr>
	
	<tr valign="top">
        <th scope="row"><?php _e('Display Title'); ?></th>
        <td>
          <input name="<?php echo $this->get_field_name('show_title'); ?>" type="checkbox" value="on" <?php  if( $show_title == 'on' ) echo ' checked '; ?> />

        </td>
    </tr>
	<tr valign="top">
        <th scope="row"><?php _e('Display Content'); ?></th>
        <td>
          <input name="<?php echo $this->get_field_name('show_content'); ?>" type="checkbox"  value="on" <?php  if( $show_content == 'on' ) echo ' checked '; ?> />

        </td>
    </tr>
	
	<tr valign="top">
        <th scope="row"><?php _e('Display Author'); ?></th>
        <td>
          <input name="<?php echo $this->get_field_name('show_author'); ?>" type="checkbox"  value="on" <?php  if( $show_author == 'on' ) echo ' checked '; ?> />

        </td>
    </tr>
	
	<tr valign="top">
        <th scope="row"><?php _e('Display Date'); ?></th>
        <td>
          <input name="<?php echo $this->get_field_name('show_date'); ?>" type="checkbox"  value="on" <?php  if( $show_date == 'on' ) echo ' checked '; ?> />

        </td>
    </tr>
    
    <tr valign="top">
        <th scope="row"><?php _e('Content max char'); ?></th>
        <td>
          
          <input type="text"  name="<?php echo $this->get_field_name('cont_max'); ?>"  value="<?php echo $cont_max; ?>" />		 

        </td>
    </tr>
	
	<tr valign="top">
        <th scope="row"> <?php _e('Title max char'); ?> </th>
        <td>
          
          <input type="text"  name="<?php echo $this->get_field_name('title_max'); ?>"  value="<?php echo $title_max; ?>" />		 

        </td>
    </tr>

	<tr valign="top">
        <th scope="row" > <?php _e('Effects Speed'); ?> </th>
        <td>
          
          <input type="text"  name="<?php echo $this->get_field_name('ef_speed'); ?>"  value="<?php echo $ef_speed; ?>" />		 
		<p><?php _e('E.g: 600'); ?></p>
        </td>
    </tr>
    
    
</table>
		
		<?php 
	}

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

?>