evolve_carousel_WP_Widget

The evolve evolve carousel WP Widget class.

Defined (1)

The class is defined in the following location(s).

/library/functions/widgets.php  
  1. class evolve_carousel_WP_Widget extends WP_Widget { 
  2.  
  3. function __construct() { 
  4. $widget_ops = array( 
  5. 'classname' => 'carousel-slider',  
  6. 'description' => __('Insert your custom image slides', 'evolve') 
  7. ); 
  8. $control_ops = array('width' => 400, 'height' => 350); 
  9. parent::__construct('carousel-slider', __('evolve: Carousel Slider', 'evolve'), $widget_ops, $control_ops); 
  10.  
  11. function widget($args, $instance) { 
  12. extract($args); 
  13. $title = apply_filters('widget_title', empty($instance['title']) ? '' : $instance['title'], $instance, $this->id_base); 
  14. $text = apply_filters('widget_text', empty($instance['text']) ? '' : $instance['text'], $instance); 
  15. echo $before_widget; 
  16. if (!empty($title)) { 
  17. echo $before_title . $title . $after_title; 
  18. ?> 
  19. <div class="textwidget"><?php echo!empty($instance['filter']) ? wpautop($text) : $text; ?></div> 
  20. <?php 
  21. echo $after_widget; 
  22.  
  23. function update($new_instance, $old_instance) { 
  24. $instance = $old_instance; 
  25. $instance['title'] = strip_tags($new_instance['title']); 
  26. if (current_user_can('unfiltered_html')) { 
  27. $instance['text'] = $new_instance['text']; 
  28. } else { 
  29. $instance['text'] = stripslashes(wp_filter_post_kses(addslashes($new_instance['text']))); 
  30. }// wp_filter_post_kses() expects slashed 
  31. $instance['filter'] = isset($new_instance['filter']); 
  32.  
  33. return $instance; 
  34.  
  35. function form($instance) { 
  36.  
  37. $evolve_defaultslider = "<div id='myCarousel' class='carousel slide' data-ride='carousel'> 
  38.  
  39. <ol class='carousel-indicators'> 
  40. <li data-target='#myCarousel' data-slide-to='0' class='active'></li> 
  41. <li data-target='#myCarousel' data-slide-to='1'></li> 
  42. <li data-target='#myCarousel' data-slide-to='2'></li> 
  43. <li data-target='#myCarousel' data-slide-to='3'></li> 
  44. </ol> 
  45.  
  46. <div class='carousel-inner'> 
  47.  
  48. <div class='item active'> 
  49. <img src='" . get_template_directory_uri() . "/assets/images/bootstrap-slider/1.jpg' alt='' /> 
  50. <div class='carousel-caption'> 
  51. <h4>Built-in Bootstrap Elements and Font Awesome let you do amazing things with your website</h4> 
  52. </div> 
  53. </div> 
  54.  
  55. <div class='item'> 
  56. <img src='" . get_template_directory_uri() . "/assets/images/bootstrap-slider/2.jpg' alt='' /> 
  57. <div class='carousel-caption'> 
  58. <h4>Easy to use control panel with a lot of options</h4>  
  59. </div> 
  60. </div> 
  61.  
  62. <div class='item'> 
  63. <img src='" . get_template_directory_uri() . "/assets/images/bootstrap-slider/3.jpg' alt='' /> 
  64. <div class='carousel-caption'> 
  65. <h4>Fully responsive theme for any device</h4>  
  66. </div> 
  67. </div>  
  68.  
  69. <div class='item'> 
  70. <img src='" . get_template_directory_uri() . "/assets/images/bootstrap-slider/4.jpg' alt='' /> 
  71. <div class='carousel-caption'> 
  72. <h4>Unlimited color schemes</h4>  
  73. </div> 
  74. </div> 
  75.  
  76. </div><!--/.carousel-inner--> 
  77.  
  78. <a class='left carousel-control' href='#myCarousel' data-slide='prev'></a> 
  79.  
  80. <a class='right carousel-control' href='#myCarousel' data-slide='next'></a> 
  81.  
  82. </div><!--/#myCarousel-->"; 
  83.  
  84.  
  85. $instance = wp_parse_args((array) $instance, array('title' => '', 'text' => $evolve_defaultslider)); 
  86. $title = strip_tags($instance['title']); 
  87. $text = esc_textarea($instance['text']); 
  88. ?> 
  89. <p><label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:', 'evolve'); ?></label> 
  90. <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); ?>"/> 
  91. </p> 
  92.  
  93. <textarea class="widefat" rows="16" cols="20" id="<?php echo $this->get_field_id('text'); ?>" name="<?php echo $this->get_field_name('text'); ?>"><?php echo $text; ?></textarea> 
  94.  
  95. <?php 
  96.