google_ads_master_widget_ads

The Google Ads Master google ads master widget class.

Defined (1)

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

/includes/google-ads-master-widget-ads.php  
  1. class google_ads_master_widget_ads extends WP_Widget { 
  2. function __construct() { 
  3. $widget_ops = array( 'classname' => 'Google Ads Master', 'description' => __('Google Ads Master for wordpress is the professional plugin you need to generate income with your website. ', 'google_ads_master') ); 
  4. $control_ops = array( 'width' => 300, 'height' => 350, 'id_base' => 'google_ads_master_widget_ads' ); 
  5. parent::__construct( 'google_ads_master_widget_ads', __('Google Ads Master', 'google_ads_master'), $widget_ops, $control_ops ); 
  6.  
  7. function widget( $args, $instance ) { 
  8. extract( $args ); 
  9. //Our variables from the widget settings. 
  10. $google_ads_title = isset( $instance['google_ads_title'] ) ? $instance['google_ads_title'] :false; 
  11. $google_ads_title_new = isset( $instance['google_ads_title_new'] ) ? $instance['google_ads_title_new'] :false; 
  12. $googleadsspacer ="'"; 
  13. $show_googleads = isset( $instance['show_googleads'] ) ? $instance['show_googleads'] :false; 
  14. $googleads_code = $instance['googleads_code']; 
  15. $google_code_align = $instance['google_code_align']; 
  16. echo $before_widget; 
  17.  
  18. // Display the widget title 
  19. if ( $google_ads_title ) { 
  20. if (empty ($google_ads_title_new)) { 
  21. $google_ads_title_new = constant('GOOGLE_ADS_MASTER_NAME'); 
  22. echo $before_title . $google_ads_title_new . $after_title; 
  23. else{ 
  24. echo $before_title . $google_ads_title_new . $after_title; 
  25. else{ 
  26. //Prepare Google Ads Alignment 
  27. if (empty($google_code_align)) { 
  28. $google_code_align = 'style="float:left;"'; 
  29. if ($google_code_align == "left") { 
  30. $google_code_align = 'style="float:left;"'; 
  31. if ($google_code_align == "right") { 
  32. $google_code_align = 'style="float:right;"'; 
  33. if ($google_code_align == "center") { 
  34. $google_code_align = 'style="text-align:center;"'; 
  35. //Display Google Ads 
  36. if ( $show_googleads ) { 
  37. echo '<div '.$google_code_align.'>' . 
  38. $googleads_code . 
  39. '</div>'; 
  40. else{ 
  41. echo $after_widget; 
  42. //Update the widget 
  43. function update( $new_instance, $old_instance ) { 
  44. $instance = $old_instance; 
  45. //Strip tags from title and name to remove HTML 
  46. $instance['google_ads_title'] = strip_tags( $new_instance['google_ads_title'] ); 
  47. $instance['google_ads_title_new'] = $new_instance['google_ads_title_new']; 
  48. $instance['show_googleads'] = $new_instance['show_googleads']; 
  49. $instance['googleads_code'] = $new_instance['googleads_code']; 
  50. $instance['google_code_align'] = $new_instance['google_code_align']; 
  51. return $instance; 
  52. function form( $instance ) { 
  53. $plugin_master_name = constant('GOOGLE_ADS_MASTER_NAME'); 
  54. //Set up some default widget settings. 
  55. $defaults = array( 'google_ads_title_new' => __('Google Ads Master', 'google_ads_master'), 'google_ads_title' => true, 'google_ads_title_new' => false, 'show_googleads' => false, 'googleads_code' => false, 'google_code_align' => false ); 
  56. $instance = wp_parse_args( (array) $instance, $defaults ); 
  57. ?> 
  58. <br> 
  59. <b>Check the buttons to be displayed:</b> 
  60. <p> 
  61. <img src="<?php echo plugins_url('images/techgasp-minilogo-16.png', dirname(__FILE__)); ?>" style="float:left; height:18px; vertical-align:middle;" /> 
  62.   
  63. <input type="checkbox" <?php checked( (bool) $instance['google_ads_title'], true ); ?> id="<?php echo $this->get_field_id( 'google_ads_title' ); ?>" name="<?php echo $this->get_field_name( 'google_ads_title' ); ?>" /> 
  64. <label for="<?php echo $this->get_field_id( 'google_ads_title' ); ?>"><b><?php _e('Display Widget Title', 'google_ads_master'); ?></b></label></br> 
  65. </p> 
  66. <p> 
  67. <label for="<?php echo $this->get_field_id( 'google_ads_title_new' ); ?>"><?php _e('Change Title:', 'google_ads_master'); ?></label> 
  68. <br> 
  69. <input id="<?php echo $this->get_field_id( 'google_ads_title_new' ); ?>" name="<?php echo $this->get_field_name( 'google_ads_title_new' ); ?>" value="<?php echo $instance['google_ads_title_new']; ?>" style="width:auto;" /> 
  70. </p> 
  71. <div style="background: url(<?php echo plugins_url('images/techgasp-hr.png', dirname(__FILE__)); ?>) repeat-x; height: 10px"></div> 
  72. <p> 
  73. <img src="<?php echo plugins_url('images/techgasp-minilogo-16.png', dirname(__FILE__)); ?>" style="float:left; height:18px; vertical-align:middle;" /> 
  74.   
  75. <input type="checkbox" <?php checked( (bool) $instance['show_googleads'], true ); ?> id="<?php echo $this->get_field_id( 'show_googleads' ); ?>" name="<?php echo $this->get_field_name( 'show_googleads' ); ?>" /> 
  76. <label for="<?php echo $this->get_field_id( 'show_googleads' ); ?>"><b><?php _e('Display Google Ads', 'google_ads_master'); ?></b></label> 
  77. </p> 
  78. <p> 
  79. <label for="<?php echo $this->get_field_id( 'googleads_code' ); ?>"><?php _e('insert Google Ad Code:', 'google_ads_master'); ?></label></br> 
  80. <textarea cols="30" rows="5" id="<?php echo $this->get_field_id( 'googleads_code' ); ?>" name="<?php echo $this->get_field_name( 'googleads_code' ); ?>" ><?php echo stripslashes ($instance['googleads_code']); ?></textarea> 
  81. <div class="description">Copy and Paste your google ad script code from Google AdSense website.</div> 
  82. </p> 
  83. <p> 
  84. <img src="<?php echo plugins_url('images/techgasp-minilogo-16.png', dirname(__FILE__)); ?>" style="float:left; height:18px; vertical-align:middle;" /> 
  85.   
  86. <label for="<?php echo $this->get_field_id( 'google_code_align' ); ?>"><b><?php _e('Google Ad Align', 'google_ads_master'); ?></label></b></br> 
  87. <input id="<?php echo $this->get_field_id( 'google_code_align' ); ?>" name="<?php echo $this->get_field_name( 'google_code_align' ); ?>" value="<?php echo $instance['google_code_align']; ?>" style="width:auto;" /> 
  88. <div class="description">Special option for theme sidebars, but can be used on other widget theme locations if you need to align the google ad.</div> 
  89. <div class="description">Available options are: <b>left</b>, <b>center</b> and <b>right</b></div> 
  90. <div class="description">if empty or blank, left alignment is assumed.</div> 
  91. </p> 
  92. <div style="background: url(<?php echo plugins_url('images/techgasp-hr.png', dirname(__FILE__)); ?>) repeat-x; height: 10px"></div> 
  93. <p> 
  94. <img src="<?php echo plugins_url('images/techgasp-minilogo-16.png', dirname(__FILE__)); ?>" style="float:left; width:18px; vertical-align:middle;" /> 
  95.   
  96. <b><?php echo $plugin_master_name; ?> Website</b> 
  97. </p> 
  98. <p><a class="button-secondary" href="https://wordpress.techgasp.com/google-ads-master/" target="_blank" title="<?php echo $plugin_master_name; ?> Info Page">Info Page</a> <a class="button-secondary" href="https://wordpress.techgasp.com/google-ads-master-documentation/" target="_blank" title="<?php echo $plugin_master_name; ?> Documentation">Documentation</a> <a class="button-primary" href="https://wordpress.org/plugins/google-ads-master/" target="_blank" title="<?php echo $plugin_master_name; ?> Wordpress">RATE US *****</a></p> 
  99. <?php