google_ads_master_widget_viral

The Google Ads Master google ads master widget viral class.

Defined (1)

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

/includes/google-ads-master-widget-viral.php  
  1. class google_ads_master_widget_viral extends WP_Widget { 
  2. function __construct() { 
  3. $widget_ops = array( 'classname' => 'Google Ads Master Viral', 'description' => __('This Widget turns your Wordpress "virulent" by allowing people to +1 and Share your pages. Watch those visits explode and greatly boost your google ads clicks! ', 'google_ads_master') ); 
  4. $control_ops = array( 'width' => 300, 'height' => 350, 'id_base' => 'google_ads_master_widget_viral' ); 
  5. parent::__construct( 'google_ads_master_widget_viral', __('Google Ads Master Viral', '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_google_plus = isset( $instance['show_google_plus'] ) ? $instance['show_google_plus'] :false; 
  14. $google_plus_bubble = isset( $instance['google_plus_bubble'] ) ? $instance['google_plus_bubble'] :false; 
  15. $show_google_share = isset( $instance['show_google_share'] ) ? $instance['show_google_share'] :false; 
  16. $google_share_bubble = isset( $instance['google_share_bubble'] ) ? $instance['google_share_bubble'] :false; 
  17. $show_google_follow = isset( $instance['show_google_follow'] ) ? $instance['show_google_follow'] :false; 
  18. $google_follow_bubble = isset( $instance['google_follow_bubble'] ) ? $instance['google_follow_bubble'] :false; 
  19. $google_follow_page = $instance['google_follow_page']; 
  20. echo $before_widget; 
  21.  
  22. // Display the widget title 
  23. if ( $google_ads_title ) { 
  24. if (empty ($google_ads_title_new)) { 
  25. $google_ads_title_new = constant('GOOGLE_ADS_MASTER_NAME'); 
  26. echo $before_title . $google_ads_title_new . $after_title; 
  27. else{ 
  28. echo $before_title . $google_ads_title_new . $after_title; 
  29. else{ 
  30. //Display Google Plus 
  31. if ( $show_google_plus ) { 
  32. //Prepare Google Plus Bubble Count 
  33. if ( $google_plus_bubble ) { 
  34. $google_plus_bubble_create = '<div class="g-plusone" data-height="24"></div>'; 
  35. else{ 
  36. $google_plus_bubble_create = '<div class="g-plusone" data-annotation="none" data-height="24"></div>   '; 
  37. else{ 
  38. $google_plus_bubble_create = false; 
  39.  
  40. //Display Google Share 
  41. if ( $show_google_share ) { 
  42. //Prepare Google Share Bubble Count 
  43. if ( $google_share_bubble ) { 
  44. $google_share_bubble_create = '<div class="g-plus" data-action="share" data-annotation="bubble" data-height="24"></div>'; 
  45. else{ 
  46. $google_share_bubble_create = '<div class="g-plus" data-action="share" data-annotation="none" data-height="24"></div>'; 
  47. else{ 
  48. $google_share_bubble_create = false; 
  49.  
  50. //Display Google Folllow 
  51. if ( $show_google_follow ) { 
  52. //Prepare Google Share Bubble Count 
  53. if ( $google_follow_bubble ) { 
  54. $google_follow_bubble_create = '<div class="g-follow" data-annotation="bubble" data-height="24" data-href="'.$google_follow_page.'" data-rel="author"></div>'; 
  55. else{ 
  56. $google_follow_bubble_create = '<div class="g-follow" data-annotation="none" data-height="24" data-href="'.$google_follow_page.'" data-rel="author"></div>'; 
  57. else{ 
  58. $google_share_bubble_create = false; 
  59.  
  60.  
  61. echo '<div style="width:100%; overflow: visible;">' . 
  62. '<div style="width:32%; float: left;">' . 
  63. $google_plus_bubble_create . 
  64. '</div>' . 
  65. '<div style="width:33%; float: left;">' . 
  66. $google_share_bubble_create . 
  67. '</div>' . 
  68. '<div style="width:33%; float: left;">' . 
  69. $google_follow_bubble_create . 
  70. '</div>' . 
  71. '</div>' . 
  72. '<script type="text/javascript">' . 
  73. '(function() {' . 
  74. 'var po = document.createElement('.$googleadsspacer.'script'.$googleadsspacer.'); po.type = '.$googleadsspacer.'text/javascript'.$googleadsspacer.'; po.async = true;' . 
  75. 'po.src = '.$googleadsspacer.'https://apis.google.com/js/platform.js'.$googleadsspacer.';' . 
  76. 'var s = document.getElementsByTagName('.$googleadsspacer.'script'.$googleadsspacer.')[0]; s.parentNode.insertBefore(po, s);' . 
  77. '})();' . 
  78. '</script>' . 
  79. $after_widget; 
  80. //Update the widget 
  81. function update( $new_instance, $old_instance ) { 
  82. $instance = $old_instance; 
  83. //Strip tags from title and name to remove HTML 
  84. $instance['google_ads_title'] = strip_tags( $new_instance['google_ads_title'] ); 
  85. $instance['google_ads_title_new'] = $new_instance['google_ads_title_new']; 
  86. $instance['show_google_plus'] = $new_instance['show_google_plus']; 
  87. $instance['google_plus_bubble'] = $new_instance['google_plus_bubble']; 
  88. $instance['show_google_share'] = $new_instance['show_google_share']; 
  89. $instance['google_share_bubble'] = $new_instance['google_share_bubble']; 
  90. $instance['show_google_follow'] = $new_instance['show_google_follow']; 
  91. $instance['google_follow_bubble'] = $new_instance['google_follow_bubble']; 
  92. $instance['google_follow_page'] = $new_instance['google_follow_page']; 
  93. return $instance; 
  94. function form( $instance ) { 
  95. $plugin_master_name = constant('GOOGLE_ADS_MASTER_NAME'); 
  96. //Set up some default widget settings. 
  97. $defaults = array( 'google_ads_title_new' => __('Google Ads Master', 'google_ads_master'), 'google_ads_title' => true, 'google_ads_title_new' => false, 'show_google_plus' => true, 'google_plus_bubble' => true, 'show_google_share' => true, 'google_share_bubble' => true, 'show_google_follow' => true, 'google_follow_bubble' => true, 'google_follow_page' => false ); 
  98. $instance = wp_parse_args( (array) $instance, $defaults ); 
  99. ?> 
  100. <br> 
  101. <b>Check the buttons to be displayed:</b> 
  102. <p> 
  103. <img src="<?php echo plugins_url('images/techgasp-minilogo-16.png', dirname(__FILE__)); ?>" style="float:left; height:18px; vertical-align:middle;" /> 
  104.   
  105. <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' ); ?>" /> 
  106. <label for="<?php echo $this->get_field_id( 'google_ads_title' ); ?>"><b><?php _e('Display Widget Title', 'google_ads_master'); ?></b></label></br> 
  107. </p> 
  108. <p> 
  109. <label for="<?php echo $this->get_field_id( 'google_ads_title_new' ); ?>"><?php _e('Change Title:', 'google_ads_master'); ?></label> 
  110. <br> 
  111. <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;" /> 
  112. </p> 
  113. <div style="background: url(<?php echo plugins_url('images/techgasp-hr.png', dirname(__FILE__)); ?>) repeat-x; height: 10px"></div> 
  114. <p> 
  115. <img src="<?php echo plugins_url('images/techgasp-minilogo-16.png', dirname(__FILE__)); ?>" style="float:left; height:18px; vertical-align:middle;" /> 
  116.   
  117. <input type="checkbox" <?php checked( (bool) $instance['show_google_plus'], true ); ?> id="<?php echo $this->get_field_id( 'show_google_plus' ); ?>" name="<?php echo $this->get_field_name( 'show_google_plus' ); ?>" /> 
  118. <label for="<?php echo $this->get_field_id( 'show_google_plus' ); ?>"><b><?php _e('Display Google Plus Button', 'google_ads_master'); ?></b></label> 
  119. </p> 
  120. <p> 
  121. <input type="checkbox" <?php checked( (bool) $instance['google_plus_bubble'], true ); ?> id="<?php echo $this->get_field_id( 'google_plus_bubble' ); ?>" name="<?php echo $this->get_field_name( 'google_plus_bubble' ); ?>" /> 
  122. <label for="<?php echo $this->get_field_id( 'google_plus_bubble' ); ?>"><b><?php _e('Google Plus Bubble Count', 'google_ads_master'); ?></b></label> 
  123. </p> 
  124. <div style="background: url(<?php echo plugins_url('images/techgasp-hr.png', dirname(__FILE__)); ?>) repeat-x; height: 10px"></div> 
  125. <p> 
  126. <img src="<?php echo plugins_url('images/techgasp-minilogo-16.png', dirname(__FILE__)); ?>" style="float:left; height:18px; vertical-align:middle;" /> 
  127.   
  128. <input type="checkbox" <?php checked( (bool) $instance['show_google_share'], true ); ?> id="<?php echo $this->get_field_id( 'show_google_share' ); ?>" name="<?php echo $this->get_field_name( 'show_google_share' ); ?>" /> 
  129. <label for="<?php echo $this->get_field_id( 'show_google_share' ); ?>"><b><?php _e('Display Google Share Button', 'google_ads_master'); ?></b></label> 
  130. </p> 
  131. <p> 
  132. <input type="checkbox" <?php checked( (bool) $instance['google_share_bubble'], true ); ?> id="<?php echo $this->get_field_id( 'google_share_bubble' ); ?>" name="<?php echo $this->get_field_name( 'google_share_bubble' ); ?>" /> 
  133. <label for="<?php echo $this->get_field_id( 'google_share_bubble' ); ?>"><b><?php _e('Google Share Bubble Count', 'google_ads_master'); ?></b></label> 
  134. </p> 
  135. <div style="background: url(<?php echo plugins_url('images/techgasp-hr.png', dirname(__FILE__)); ?>) repeat-x; height: 10px"></div> 
  136. <p> 
  137. <img src="<?php echo plugins_url('images/techgasp-minilogo-16.png', dirname(__FILE__)); ?>" style="float:left; height:18px; vertical-align:middle;" /> 
  138.   
  139. <input type="checkbox" <?php checked( (bool) $instance['show_google_follow'], true ); ?> id="<?php echo $this->get_field_id( 'show_google_follow' ); ?>" name="<?php echo $this->get_field_name( 'show_google_follow' ); ?>" /> 
  140. <label for="<?php echo $this->get_field_id( 'show_google_follow' ); ?>"><b><?php _e('Display Google Follow Button', 'google_ads_master'); ?></b></label> 
  141. </p> 
  142. <p> 
  143. <input type="checkbox" <?php checked( (bool) $instance['google_follow_bubble'], true ); ?> id="<?php echo $this->get_field_id( 'google_follow_bubble' ); ?>" name="<?php echo $this->get_field_name( 'google_follow_bubble' ); ?>" /> 
  144. <label for="<?php echo $this->get_field_id( 'google_follow_bubble' ); ?>"><b><?php _e('Google Follow Bubble Count', 'google_ads_master'); ?></b></label> 
  145. </p> 
  146. <p> 
  147. <img src="<?php echo plugins_url('images/techgasp-minilogo-16.png', dirname(__FILE__)); ?>" style="float:left; height:18px; vertical-align:middle;" /> 
  148.   
  149. <label for="<?php echo $this->get_field_id( 'google_follow_page' ); ?>"><b><?php _e('Google+ User Page Link:', 'google_ads_master'); ?></label></b></br> 
  150. <input id="<?php echo $this->get_field_id( 'google_follow_page' ); ?>" name="<?php echo $this->get_field_name( 'google_follow_page' ); ?>" value="<?php echo $instance['google_follow_page']; ?>" style="width:auto;" /> 
  151. <div class="description">Example:</div> 
  152. <div class="description"><b>https://plus.google.com/113505825008581970710/</b></div> 
  153. </p> 
  154. <div style="background: url(<?php echo plugins_url('images/techgasp-hr.png', dirname(__FILE__)); ?>) repeat-x; height: 10px"></div> 
  155. <p> 
  156. <img src="<?php echo plugins_url('images/techgasp-minilogo-16.png', dirname(__FILE__)); ?>" style="float:left; width:18px; vertical-align:middle;" /> 
  157.   
  158. <b><?php echo $plugin_master_name; ?> Website</b> 
  159. </p> 
  160. <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> 
  161. <?php