afo_fb_login

The Facebook Login Widget afo fb login class.

Defined (1)

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

/login.php  
  1. class afo_fb_login { 
  2.  
  3. public function __construct() { 
  4. add_action( 'admin_menu', array( $this, 'facebook_login_widget_afo_menu' ) ); 
  5. add_action( 'admin_init', array( $this, 'facebook_login_widget_afo_save_settings' ) ); 
  6. add_action( 'plugins_loaded', array( $this, 'fb_login_widget_text_domain' ) ); 
  7. add_action( 'admin_enqueue_scripts', array( $this, 'register_plugin_styles' ) ); 
  8.  
  9. public function register_plugin_styles() { 
  10. wp_enqueue_style( 'style_login_admin', plugins_url( 'facebook-login-afo/style_login_admin.css' ) ); 
  11.  
  12. public function fb_login_widget_afo_options () { 
  13. echo '<div class="wrap">'; 
  14. global $wpdb; 
  15. $afo_fb_app_id = get_option('afo_fb_app_id'); 
  16. $afo_fb_app_secret = get_option('afo_fb_app_secret'); 
  17. $default_login_form_hooks = get_option('default_login_form_hooks'); 
  18.  
  19. $this->show_message(); 
  20. $this->fb_login_pro_add(); 
  21. $this->wp_register_profile_add(); 
  22. $this->help_support(); 
  23. ?> 
  24. <form name="f" method="post" action=""> 
  25. <input type="hidden" name="option" value="facebook_login_widget_afo_save_settings" /> 
  26. <?php wp_nonce_field( 'fb_login_widget_afo_save_action', 'fb_login_widget_afo_save_action_field' ); ?> 
  27. <table width="100%" border="0" style="background-color:#FFFFFF; border:1px solid #CCCCCC; padding:0px 0px 0px 10px; margin:2px;"> 
  28. <tr> 
  29. <td width="45%"><h1>Facebook Login Widget</h1></td> 
  30. <td width="55%"> </td> 
  31. </tr> 
  32. <tr> 
  33. <td><strong>Facebook App ID:</strong></td> 
  34. <td><input type="text" name="afo_fb_app_id" value="<?php echo $afo_fb_app_id;?>" /></td> 
  35. </tr> 
  36. <tr> 
  37. <td><strong>Facebook App Secret:</strong></td> 
  38. <td><input type="text" name="afo_fb_app_secret" value="<?php echo $afo_fb_app_secret;?>" /></td> 
  39. </tr> 
  40. <tr> 
  41. <td colspan="2"><a href="http://www.aviplugins.com/fb-login-widget-pro/#facebook-app" target="_blank">How to Setup Facebook APP</a></td> 
  42. </tr> 
  43. <tr> 
  44. <td width="45%"><h1><?php _e('Compatibility', 'login-sidebar-widget');?></h1></td> 
  45. <td width="55%"> </td> 
  46. </tr> 
  47. <tr> 
  48. <td valign="top"><strong><?php _e('Enable default WordPress login form hooks', 'login-sidebar-widget');?></strong></td> 
  49. <td><input type="checkbox" name="default_login_form_hooks" value="Yes" <?php echo $default_login_form_hooks == 'Yes'?'checked="checked"':'';?> /><i>Check to <strong>Enable</strong> default WordPress login form hooks. This will make the login form compatible with other plugins. For example <strong>Enable</strong> this if you want to use CAPTCHA on login, from another plugin. <strong>Disable</strong> this so that no other plugins can interfere with your login form.</i></td> 
  50. </tr> 
  51. <tr> 
  52. <td> </td> 
  53. <td><input type="submit" name="submit" value="Save" class="button button-primary button-large" /></td> 
  54. </tr> 
  55. <tr> 
  56. <td colspan="2"><p>Click here to get <a href="http://www.aviplugins.com/microsoft-login-addon/" target="_blank">Microsoft Login Addon</a>, <a href="http://www.aviplugins.com/yahoo-login-addon/" target="_blank">Yahoo Login Addon</a></p><hr></td> 
  57. </tr> 
  58. <tr> 
  59. <td colspan="2"><?php $this->fb_login_help();?></td> 
  60.  
  61. </tr> 
  62. </table> 
  63. </form> 
  64. <?php  
  65. $this->fb_comment_addon_add(); 
  66. $this->social_login_no_setup_add(); 
  67. if ( !is_plugin_active( 'fb-comments-afo-addon/fb_comment.php' ) ) { $this->donate(); } 
  68. echo '</div>'; 
  69.  
  70. public function wp_register_profile_add() { ?> 
  71. <table width="100%" border="0" style="background-color:#FFFFFF; border:1px solid #CCCCCC; padding:0px 0px 0px 10px; margin:2px;"> 
  72. <tr> 
  73. <td><p><strong>Facebook Login Widget</strong> recommends you to download and activate <a href="https://wordpress.org/plugins/wp-register-profile-with-shortcode/" target="_blank">WP Register Profile With Shortcode</a> from <a href="https://wordpress.org/" target="_blank">wordpress.org</a> so that users can register in your site.</p></td> 
  74. </tr> 
  75. </table> 
  76. <?php } 
  77.  
  78. public function fb_login_widget_text_domain() { 
  79. load_plugin_textdomain('facebook-login-afo', FALSE, basename( dirname( __FILE__ ) ) .'/languages'); 
  80.  
  81. public function fb_login_help() { ?> 
  82. <p><font color="#FF0000"><strong>Note*</strong></font> 
  83. <br /> 
  84. You need create a new facebook API Applitation to setup this plugin. Please follow the instructions provided below. 
  85. </p> 
  86. <p> 
  87. <strong>1.</strong> Go to <a href="https://developers.facebook.com/" target="_blank">https://developers.facebook.com/</a> <br /><br /> 
  88. <strong>2.</strong> Click on Create a new app button. A popup will open.<br /><br /> 
  89. <strong>3.</strong> Add the required informations and don't forget to make your app live. This is very important otherwise your app will not work for all users.<br /><br /> 
  90. <strong>4.</strong> Then Click the "Create App" button and follow the instructions, your new app will be created. <br /><br /> 
  91. <strong>5.</strong> Copy and Paste "App ID" and "App Secret" here. <br /><br /> 
  92. <strong>6.</strong> That's All. Have fun :) 
  93. </p>  
  94. <?php } 
  95.  
  96. public function fb_comment_plugin_addon_options() { 
  97. echo '<div class="wrap">'; 
  98. global $wpdb; 
  99. $fb_comment_addon = new afo_fb_comment_settings; 
  100. $fb_comments_color_scheme = get_option('fb_comments_color_scheme'); 
  101. $fb_comments_width = get_option('fb_comments_width'); 
  102. $fb_comments_no = get_option('fb_comments_no'); 
  103. $this->show_message(); 
  104. ?> 
  105. <form name="f" method="post" action=""> 
  106. <input type="hidden" name="option" value="save_afo_fb_comment_settings" /> 
  107. <table width="100%" border="0" style="background-color:#FFFFFF; margin-top:20px; width:98%; padding:5px; border:1px solid #999999; "> 
  108. <tr> 
  109. <td colspan="2"><h1>Social Comments Settings</h1></td> 
  110. </tr> 
  111. <?php do_action('fb_comments_settings_top');?> 
  112. <tr> 
  113. <td><h3>Facebook Comments</h3></td> 
  114. <td></td> 
  115. </tr> 
  116. <tr> 
  117. <td><strong>Language</strong></td> 
  118. <td><select name="fb_comments_language"> 
  119. <option value=""> -- </option> 
  120. <?php echo $fb_comment_addon->language_selected($fb_comments_language);?> 
  121. </select> 
  122. </td> 
  123. </tr> 
  124. <tr> 
  125. <td><strong>Color Scheme</strong></td> 
  126. <td><select name="fb_comments_color_scheme"> 
  127. <?php echo $fb_comment_addon->get_color_scheme_selected($fb_comments_color_scheme);?> 
  128. </select> 
  129. </td> 
  130. </tr> 
  131. <tr> 
  132. <td><strong>Width</strong></td> 
  133. <td><input type="text" name="fb_comments_width" value="<?php echo $fb_comments_width;?>"/> In Percent (%)</td> 
  134. </tr> 
  135. <tr> 
  136. <td><strong>No of Comments</strong></td> 
  137. <td><input type="text" name="fb_comments_no" value="<?php echo $fb_comments_no;?>"/> Default is 10</td> 
  138. </tr> 
  139. <?php do_action('fb_comments_settings_bottom');?> 
  140. <tr> 
  141. <td> </td> 
  142. <td><input type="submit" name="submit" value="Save" class="button button-primary button-large" /></td> 
  143. </tr> 
  144. <tr> 
  145. <td> </td> 
  146. <td> </td> 
  147. </tr> 
  148. <tr> 
  149. <td colspan="2">Use <span style="color:#000066;">[social_comments]</span> shortcode to display Facebook / Disqus Comments in post or page.<br /> 
  150. Example: <span style="color:#000066;">[social_comments title="Comments"]</span> 
  151. <br /> <br /> 
  152. Or else<br /> <br /> 
  153. You can use this function <span style="color:#000066;">social_comments()</span> in your template to display the Facebook Comments. <br /> 
  154. Example: <span style="color:#000066;"><?php social_comments("Comments");?></span> 
  155. </td> 
  156. </tr> 
  157. </table> 
  158. </form> 
  159. <?php  
  160. echo '</div>'; 
  161.  
  162. public function show_message() { 
  163. if( isset($GLOBALS['msg']) ) { 
  164. echo '<div class="success_wid_login">'.$GLOBALS['msg'].'</div>'; 
  165.  
  166. public function facebook_login_widget_afo_save_settings() { 
  167. if(isset($_POST['option']) and sanitize_text_field($_POST['option']) == "facebook_login_widget_afo_save_settings") { 
  168.  
  169. if ( ! isset( $_POST['fb_login_widget_afo_save_action_field'] ) || ! wp_verify_nonce( $_POST['fb_login_widget_afo_save_action_field'], 'fb_login_widget_afo_save_action' ) ) { 
  170. wp_die( 'Sorry, your nonce did not verify.'); 
  171. }  
  172. update_option( 'afo_fb_app_id', sanitize_text_field( $_POST['afo_fb_app_id'] ) ); 
  173. update_option( 'afo_fb_app_secret', sanitize_text_field( $_POST['afo_fb_app_secret'] ) ); 
  174. update_option( 'default_login_form_hooks', sanitize_text_field( $_POST['default_login_form_hooks'] ) ); 
  175. $GLOBALS['msg'] = 'Data successfully updated'; 
  176.  
  177. public function facebook_login_widget_afo_menu () { 
  178. add_options_page( 'FB Login Widget', 'FB Login Widget', 'activate_plugins', 'fb_login_widget_afo', array( $this, 'fb_login_widget_afo_options' )); 
  179.  
  180. public function help_support() { ?> 
  181. <table width="100%" border="0" style="background-color:#FFFFFF; border:1px solid #CCCCCC; padding:0px 0px 0px 10px; margin:2px;"> 
  182. <tr> 
  183. <td align="right"><a href="http://www.aviplugins.com/support.php" target="_blank">Help and Support</a> <a href="http://www.aviplugins.com/rss/news.xml" target="_blank"><img src="<?php echo plugin_dir_url( __FILE__ ) . '/images/rss.png';?>" style="vertical-align: middle;" alt="RSS"></a></td> 
  184. </tr> 
  185. </table> 
  186. <?php 
  187.  
  188. public function fb_login_pro_add() { ?> 
  189. <table width="100%" border="0" style="background-color:#FFFFD2; border:1px solid #E6DB55; clear:both; padding:0px 0px 0px 10px; margin:2px;"> 
  190. <tr> 
  191. <td><p>There is a <strong>PRO</strong> version of this plugin that supports login with <strong>Facebook</strong>, <strong>Google</strong>, <strong>Twitter</strong> and <strong>LinkedIn</strong>. With user login <strong>Log</strong> functionality. Malicious <strong>IPs</strong> gets <strong>Blocked</strong> automatically after 5 wrong login attempts. <strong>CAPTCHA</strong> security in <strong>Admin</strong> and <strong>Front-end</strong> login and many more. You can get it <a href="http://www.aviplugins.com/fb-login-widget-pro/" target="_blank">here</a> in <strong>USD 3.00</strong> </p></td> 
  192. </tr> 
  193. </table> 
  194. <?php } 
  195.  
  196. public function social_login_no_setup_add() { ?> 
  197. <table width="100%" border="0" style="background-color:#FFFFD2; border:1px solid #E6DB55; padding:0px 0px 0px 10px; margin:2px;"> 
  198. <tr> 
  199. <td><p>Check out the <strong>Social Login No Setup</strong> plugin that supports login with <strong>Facebook</strong>, <strong>Google</strong>, <strong>Twitter</strong> and <strong>LinkedIn</strong>. It requires no Setups, no Maintanance, no need to create any APPs, APIs, Client Ids, Client Secrets or anything. You Just have to install the plugin. <a href="http://www.aviplugins.com/social-login-no-setup/" target="_blank">Click here for details</a>.</p></td> 
  200. </tr> 
  201. </table> 
  202. <?php } 
  203.  
  204.  
  205. public function fb_comment_addon_add() {  
  206. if ( !is_plugin_active( 'fb-comments-afo-addon/fb_comment.php' ) ) { 
  207. ?> 
  208. <table width="100%" border="0" style="background-color:#FFFFD2; border:1px solid #E6DB55; padding:0px 0px 0px 10px; margin:2px;"> 
  209. <tr> 
  210. <td><p>There is a <strong>Facebook Comments Addon</strong> for this plugin. The plugin replace the default <strong>Wordpress</strong> Comments module and enable <strong>Facebook/Disqus/Google+</strong> Comments Module. You can get it <a href="http://www.aviplugins.com/fb-comments-afo-addon/" target="_blank">here</a> in <strong>USD 1.00</strong> </p></td> 
  211. </tr> 
  212. </table> 
  213. <?php  
  214.  
  215. public function donate() { ?> 
  216. <table width="100%" border="0" style="background-color:#FFF; border:1px solid #ccc; margin:2px; padding-right:10px;"> 
  217. <tr> 
  218. <td align="right"><a href="http://www.aviplugins.com/donate/" target="_blank">Donate</a> <img src="<?php echo plugin_dir_url( __FILE__ ) . '/images/paypal.png';?>" style="vertical-align: middle;" alt="PayPal"></td> 
  219. </tr> 
  220. </table> 
  221. <?php