basic_google_apps_login

The Google Apps Login basic google apps login class.

Defined (1)

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

/google_apps_login.php  
  1. class basic_google_apps_login extends core_google_apps_login { 
  2.  
  3. protected $PLUGIN_VERSION = '2.9.7'; 
  4.  
  5. // Singleton 
  6. private static $instance = null; 
  7.  
  8. public static function get_instance() { 
  9. if (null == self::$instance) { 
  10. self::$instance = new self; 
  11. return self::$instance; 
  12.  
  13. public function ga_activation_hook($network_wide) { 
  14. parent::ga_activation_hook($network_wide); 
  15.  
  16. // If installed previously, keep 'poweredby' to off (default) since they were used to that 
  17. $old_options = get_site_option($this->get_options_name()); 
  18.  
  19. if (!$old_options) { 
  20. $new_options = $this->get_option_galogin(); 
  21. $new_option['ga_poweredby'] = true; 
  22. $this->save_option_galogin($new_option); 
  23.  
  24. protected function add_actions() { 
  25. parent::add_actions(); 
  26. add_action('wp_ajax_gal_drip_submitted', array($this, 'gal_drip_submitted')); 
  27.  
  28. protected function ga_section_text_end() { 
  29. ?> 
  30. <p><b><?php _e( 'For full support, and premium features that greatly simplify WordPress user management for admins, please visit:' , 'google-apps-login'); ?> 
  31. <a href="http://wp-glogin.com/glogin/?utm_source=Admin%20Promo&utm_medium=freemium&utm_campaign=Freemium" target="_blank">http://wp-glogin.com/</a></b> 
  32. </p> 
  33. <?php 
  34.  
  35. protected function ga_options_do_sidebar() { 
  36. $drivelink = "http://wp-glogin.com/drive/?utm_source=Admin%20Sidebar&utm_medium=freemium&utm_campaign=Drive"; 
  37. $upgradelink = "http://wp-glogin.com/glogin/?utm_source=Admin%20Sidebar&utm_medium=freemium&utm_campaign=Freemium"; 
  38. $avatarslink = "http://wp-glogin.com/avatars/?utm_source=Admin%20Sidebar&utm_medium=freemium&utm_campaign=Avatars"; 
  39. $aioilink = "http://wp-glogin.com/intranet/?utm_source=Admin%20Sidebar&utm_medium=freemium&utm_campaign=AIOI"; 
  40.  
  41. $adverts = Array(); 
  42.  
  43. $adverts[] = '<div>' 
  44. .'<a href="'.$upgradelink.'" target="_blank">' 
  45. .'<img src="'.$this->my_plugin_url().'img/basic_loginupgrade.png" />' 
  46. .'</a>' 
  47. .'<span>Buy our <a href="'.$upgradelink.'" target="_blank">premium Login plugin</a> to revolutionize user management</span>' 
  48. .'</div>'; 
  49.  
  50. $adverts[] = '<div>' 
  51. .'<a href="'.$drivelink.'" target="_blank">' 
  52. .'<img src="'.$this->my_plugin_url().'img/basic_driveplugin.png" />' 
  53. .'</a>' 
  54. .'<span>Try our <a href="'.$drivelink.'" target="_blank">Google Drive Embedder</a> plugin</span>' 
  55. .'</div>'; 
  56.  
  57. $adverts[] = '<div>' 
  58. .'<a href="'.$avatarslink.'" target="_blank">' 
  59. .'<img src="'.$this->my_plugin_url().'img/basic_avatars.png" />' 
  60. .'</a>' 
  61. .'<span>Bring your site to life with <a href="'.$avatarslink.'" target="_blank">Google Profile Avatars</a></span>' 
  62. .'</div>'; 
  63.  
  64. $adverts[] = '<div>' 
  65. .'<a href="'.$aioilink.'" target="_blank">' 
  66. .'<img src="'.$this->my_plugin_url().'img/basic_aioi.png" />' 
  67. .'</a>' 
  68. .'<span>Instantly turn WordPress into a corporate intranet with <a href="'.$aioilink.'" target="_blank">All-In-One Intranet</a></span>' 
  69. .'</div>'; 
  70.  
  71. $startnum = (int)date('j'); 
  72.  
  73. echo '<div id="gal-tableright" class="gal-tablecell">'; 
  74.  
  75. $this->output_drip_form(); 
  76.  
  77. for ($i=0 ; $i<2 ; $i++) { 
  78. echo $adverts[($startnum+$i) % 4]; 
  79.  
  80. echo '</div>'; 
  81.  
  82.  
  83. protected function output_drip_form() { 
  84. $userdata = wp_get_current_user(); 
  85. if (!$userdata) { 
  86. return; 
  87. $signedup = get_user_meta($userdata->ID, 'gal_user_signedup_to_drip', true); 
  88.  
  89. if (!$signedup) { 
  90.  
  91. $useremail = $userdata->user_email; 
  92.  
  93. ?> 
  94. <div> 
  95. <form action="https://www.getdrip.com/forms/9468024/submissions" method="post" target="_blank" data-drip-embedded-form="9468024" id="gal-drip-signup-form"> 
  96. <h3 data-drip-attribute="headline">Get the most out of Google Apps and WordPress</h3> 
  97. <p data-drip-attribute="description"> 
  98. Register your email address to receive information on building a WordPress site 
  99. that truly integrates Google Apps and WordPress. 
  100. </p> 
  101. <div> 
  102. <label for="fields[email]">Email Address</label> 
  103. <br /> 
  104. <input type="email" name="fields[email]" value="<?php echo esc_js($useremail); ?>" /> 
  105. <br /> 
  106. <input type="submit" name="submit" value="Sign Up" data-drip-attribute="sign-up-button" class="gal-drip-signup-button" /> 
  107. </div> 
  108. <p class="gal-drip-unsubscribe"> 
  109. You can unsubscribe at any time, and we will never share your email address. 
  110. </p> 
  111. </form> 
  112. </div> 
  113. <?php 
  114.  
  115. public function gal_drip_submitted() { 
  116. $userdata = wp_get_current_user(); 
  117. if (!$userdata) { 
  118. return; 
  119. update_user_meta($userdata->ID, 'gal_user_signedup_to_drip', true); 
  120.  
  121. protected function ga_domainsection_text() { 
  122. echo '<div id="domain-section" class="galtab">'; 
  123.  
  124. echo '<p>'.__('The Domain Control section is only applicable to the premium and enterprise versions of this plugin.', 'google-apps-login').'</p>'; 
  125. echo '<p>'; 
  126. _e( 'In this basic version of the plugin, any <i>existing</i> WordPress account corresponding to a Google email address can authenticate via Google.', 'google-apps-login'); 
  127. echo '</p>'; 
  128. ?> 
  129.  
  130. <h3>Premium Upgrade</h3> 
  131.  
  132. <p>In our professional plugins, you can specify your Google Apps domain name to obtain more powerful features.</p> 
  133.  
  134. <ul class="ul-disc"> 
  135. <li>Save time and increase security</li> 
  136. <li>Completely forget about WordPress user management – it syncs users from Google Apps automatically</li> 
  137. <li>Ensures that employees who leave or change roles no longer have unauthorized access to sensitive sites</li> 
  138. <li>Specify Google Groups whose members should be mapped to different roles in WordPress (Enterprise only)</li> 
  139. </ul> 
  140.  
  141. <p>Find out more about purchase options on our website: 
  142. <a href="http://wp-glogin.com/google-apps-login-premium/?utm_source=Domain%20Control&utm_medium=freemium&utm_campaign=Freemium" target="_blank">http://wp-glogin.com/</a> 
  143. </p> 
  144.  
  145. <?php 
  146. echo '</div>'; 
  147.  
  148. protected function set_other_admin_notices() { 
  149. global $pagenow; 
  150. if (in_array($pagenow, array('users.php', 'user-new.php')) ) { 
  151. $no_thanks = get_user_meta(get_current_user_id(), $this->get_options_name().'_no_thanks', true); 
  152. if (!$no_thanks) { 
  153. if (isset($_REQUEST['google_apps_login_action']) && $_REQUEST['google_apps_login_action']=='no_thanks') { 
  154. $this->ga_said_no_thanks(null); 
  155.  
  156. add_action('admin_notices', Array($this, 'ga_user_screen_upgrade_message')); 
  157. if (is_multisite()) { 
  158. add_action('network_admin_notices', Array($this, 'ga_user_screen_upgrade_message')); 
  159.  
  160. public function ga_said_no_thanks( $data ) { 
  161. update_user_meta(get_current_user_id(), $this->get_options_name().'_no_thanks', true); 
  162. wp_redirect( remove_query_arg( 'google_apps_login_action' ) ); 
  163. exit; 
  164.  
  165. public function ga_user_screen_upgrade_message() { 
  166. $purchase_url = 'http://wp-glogin.com/glogin/?utm_source=User%20Pages&utm_medium=freemium&utm_campaign=Freemium'; 
  167. $nothanks_url = add_query_arg( 'google_apps_login_action', 'no_thanks' ); 
  168. echo '<div class="updated"><p>'; 
  169. echo sprintf( __('Completely forget about WordPress user management - upgrade to <a href="%s">Google Apps Login Premium or Enterprise</a> to automatically sync users from your Google Apps domain', 'google-apps-login'),  
  170. $purchase_url ); 
  171. echo '   <a href="'.$purchase_url.'" class="button-secondary">' . __( 'Find out more', 'google-apps-login' ) . '</a>'; 
  172. echo ' <a href="' . esc_url( $nothanks_url ) . '" class="button-secondary">' . __( 'No Thanks', 'google-apps-login' ) . '</a>'; 
  173. echo '</p></div>'; 
  174.  
  175. public function my_plugin_basename() { 
  176. $basename = plugin_basename(__FILE__); 
  177. if ('/'.$basename == __FILE__) { // Maybe due to symlink 
  178. $basename = basename(dirname(__FILE__)).'/'.basename(__FILE__); 
  179. return $basename; 
  180.  
  181. protected function my_plugin_url() { 
  182. $basename = plugin_basename(__FILE__); 
  183. if ('/'.$basename == __FILE__) { // Maybe due to symlink 
  184. return plugins_url().'/'.basename(dirname(__FILE__)).'/'; 
  185. // Normal case (non symlink) 
  186. return plugin_dir_url( __FILE__ ); 
  187.