web_buis_adsens

The Business Responsive web buis adsens class.

Defined (1)

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

/admin/widgets/widget-adsens.php  
  1. class web_buis_adsens extends WP_Widget 
  2. function web_buis_adsens() { 
  3. $widget_ops = array('description' => 'Displays AdSense'); 
  4. $control_ops = array('width' => 400, 'height' => 500); 
  5. parent::WP_Widget(false, $name='AdSense', $widget_ops, $control_ops); 
  6.  
  7. /** Displays the Widget in the front-end */ 
  8. function widget($args, $instance) { 
  9. extract($args); 
  10. $title = esc_html( $instance['title']); 
  11. $adsenseCode = empty( $instance['adsenseCode'] ) ? '' : $instance['adsenseCode']; 
  12.  
  13. echo $before_widget; 
  14.  
  15. if ( $title ) 
  16. echo $before_title . $title . $after_title; 
  17. ?> 
  18. <div style="overflow: hidden;"> 
  19. <?php echo $adsenseCode; ?> 
  20. </div>  
  21. <?php 
  22. echo $after_widget; 
  23.  
  24.  
  25. /**Saves the settings. */ 
  26. function update($new_instance, $old_instance) { 
  27.  
  28. $instance = $old_instance; 
  29. $instance['title'] = sanitize_text_field( $new_instance['title'] ); 
  30. $instance['adsenseCode'] = wp_filter_post_kses( addslashes($new_instance['adsenseCode'])); 
  31.  
  32. return $instance; 
  33.  
  34.  
  35. /**Creates the form for the widget in the back-end. */ 
  36. function form($instance) { 
  37. //Defaults 
  38. $instance = wp_parse_args( (array) $instance, array( 'title'=>'AdSense', 'adsenseCode'=>'' ) ); 
  39.  
  40. $title = esc_attr( $instance['title'] ); 
  41. $adsenseCode = esc_textarea( $instance['adsenseCode'] ); 
  42.  
  43.  
  44. echo '<p><label for="' . $this->get_field_id('title') . '">' . 'Title:' . '</label><input class="widefat" id="' . $this->get_field_id('title') . '" name="' . $this->get_field_name('title') . '" type="text" value="' . $title . '" /></p>'; 
  45.  
  46.  
  47. echo '<p><label for="' . $this->get_field_id('adsenseCode') . '">' . 'AdSense Code:' . '</label><textarea cols="20" rows="12" class="widefat" id="' . $this->get_field_id('adsenseCode') . '" name="' . $this->get_field_name('adsenseCode') . '" >'. $adsenseCode .'</textarea></p>'; 
  48.  
  49.  
  50.  
  51. }// end web_buis_adv class