jfb_admin_page

Output the Admin page.

Description

jfb_admin_page(); 

Usage

  1. if ( !function_exists( 'jfb_admin_page' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'wp-fb-autoconnect/AdminPage.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = jfb_admin_page(); 
  7.  

Defined (1)

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

/AdminPage.php  
  1. function jfb_admin_page() 
  2. global $jfb_name, $jfb_version, $opt_jfb_app_token, $jfb_apiver; 
  3. global $opt_jfb_app_id, $opt_jfb_api_key, $opt_jfb_api_sec, $opt_jfb_email_to, $opt_jfb_email_logs, $opt_jfb_email_logs_missingpost, $opt_jfb_delay_redir, $jfb_homepage; 
  4. global $opt_jfb_ask_perms, $opt_jfb_mod_done, $opt_jfb_ask_stream, $opt_jfb_stream_content; 
  5. global $opt_jfb_bp_avatars, $opt_jfb_wp_avatars, $opt_jfb_valid, $opt_jfb_fulllogerr, $opt_jfb_disablenonce, $opt_jfb_show_credit; 
  6. global $opt_jfb_username_style, $opt_jfb_hidesponsor, $opt_jfb_reportstats, $opt_jfb_hidew3warning, $opt_jfb_hidewpenginewarning; 
  7. ?> 
  8. <div class="wrap"> 
  9. <h2><?php echo $jfb_name; ?> Options</h2> 
  10. <?php 
  11.  
  12. //Show applicable warnings (only on this panel's page; global warnings are above) 
  13. if(version_compare('5', PHP_VERSION, ">")) 
  14. ?><div class="error"><p><?php _e("Sorry, but as of v1.3.0, WP-FB AutoConnect requires PHP5.", 'wp-fb-autoconnect')?></p></div><?php 
  15. die(); 
  16. if( function_exists('is_multisite') && is_multisite() && !jfb_premium() ) 
  17. ?><div class="error"><p><strong><?php _e("Warning", 'wp-fb-autoconnect')?>:</strong> <?php _e("Wordpress MultiSite is only fully supported by the premium version of this plugin; please visit the documentation page for more details:", 'wp-fb-autoconnect')?> <a target='no_multisite' href='<?php echo $jfb_homepage?>#premium'><b>here</b></a></p></div><?php 
  18. if( file_exists(realpath(dirname(__FILE__))."/WP-FB-AutoConnect-Premium.php" ) ) 
  19. ?><div class="error"><p><strong><?php _e("Notice", 'wp-fb-autoconnect')?>:</strong>  
  20. <?php _e("You seem to've uploaded the premium addon to the wrong directory.", 'wp-fb-autoconnect')?><br/><br/> 
  21. <?php echo sprintf(__("The %s file needs to go in your plugins directory (%s), not the WP-FB-AutoConnect directory (%s). This is to prevent it from getting overwritten when you auto-update the core plugin.", 'wp-fb-autoconnect'), "'WP-FB-AutoConnect-Premium.php'", "i.e. wp-content/plugins/WP-FB-AutoConnect-Premium.php", "i.e. wp-content/plugins/wp-fb-autoconnect/WP-FB-AutoConnect-Premium.php")?> 
  22. </p></div> 
  23. <?php 
  24.  
  25. //Rare warning: if they've updated their plugin to 4.2.0+ (when this notice was added), *and* they're using an older premium addon,  
  26. //(from before the textdomain was changed) *and* their site is localized to one of the 2 languages to which the addon had been  
  27. //translated, warn them to update the addon. 
  28. global $locale; 
  29. if( defined('JFB_PREMIUM') && version_compare(JFB_PREMIUM_VER, 39) == -1 && isset($locale) && ($locale == 'es_ES' || $locale == 'sr_RS') ) 
  30. ?><div class="error"><p> 
  31. <strong><?php _e("Warning", 'wp-fb-autoconnect')?>:</strong>  
  32. Your site appears to be running in a foreign language, using an older version of the WP-FB-AutoConnect Premium addon. While the addon's functionality will work just fine, it may not reflect your site's selected language. This is due to a change since core plugin v4.2.0, to support localization on translate.wordpress.org.<br/><br/>If you'd like to see the translated version of the premium addon, please download the latest addon from justin-klein.com/store. If you don't mind English, feel free to disregard this message.  
  33. </p></div><?php 
  34.  
  35. do_action('wpfb_admin_messages'); 
  36.  
  37. //Which tab to show by default 
  38. $shownTab = get_option($opt_jfb_valid)?1:0; 
  39.  
  40. //When saving the Facebook options, make sure the key and secret are valid... 
  41. if( isset($_POST['fb_opts_updated']) ) 
  42. update_option( $opt_jfb_valid, 0 ); 
  43. $shownTab = 0; 
  44. $response = jfb_api_get("https://graph.facebook.com/$jfb_apiver/oauth/access_token?client_id=" . $_POST[$opt_jfb_api_key] . "&client_secret=" . $_POST[$opt_jfb_api_sec] . "&grant_type=client_credentials");  
  45. if( isset($response['access_token']) ) 
  46. //We got a valid app access token! Note: this plugin doesn't actually use the app-token after this initial  
  47. //validation; I simply cache it so it can be accessible to users wishing to further interact with Facebook  
  48. //via hooks & filters. App tokens never expire unless the app secret is refreshed. 
  49. $shownTab = 1; 
  50. update_option( $opt_jfb_valid, 1 ); 
  51. update_option( $opt_jfb_app_token, $response['access_token'] ); 
  52.  
  53. //Now I can use the app token to fetch the app's name. This isn't really necessary - just a final double-confirmation,  
  54. //and to show a 'nicer' message to the user when they save. 
  55. $result = jfb_api_get("https://graph.facebook.com/$jfb_apiver/" . $_POST[$opt_jfb_api_key] . "?fields=id, name&access_token=" . get_option($opt_jfb_app_token)); 
  56. if(!$result || isset($result[error])) 
  57. ?><div class="error"><p><?php  
  58. _e("Failed to confirm your app access token.", "wp-fb-autoconnect"); 
  59. echo "<br/>Error Message: <i>" . (isset($result[error]) && isset($result[error]['message'])?$result[error]['message']:"Unknown") . "</i><br/>"; 
  60. _e("Your plugin will probably function as normal, but if you encounter this message, please report it to the WP-FB-AutoConnect author.", "wp-fb-autoconnect") 
  61. ?></p></div><?php 
  62. else 
  63. ?><div class="updated"><p><strong><?php _e("Successfully connected with:", 'wp-fb-autoconnect')?> <?php echo "'" . $result['name'] . "' (ID " . $result['id'] . ")";?></strong></p></div><?php 
  64. else 
  65. $result = $response; 
  66. ?><div class="error"><p><?php _e("Failed to validate your App ID and Secret.", "wp-fb-autoconnect")?><br/> 
  67. Error Message: <i><?php echo (isset($result[error]['message'])?$result[error]['message']:"Unknown"); ?></i></p></div><?php 
  68.  
  69. //We can save these either way, because if "valid" isn't set, a button won't be shown. 
  70. update_option( $opt_jfb_app_id, ( isset($result['id']) ? $result['id'] : "") ); 
  71. update_option( $opt_jfb_api_key, esc_html($_POST[$opt_jfb_api_key]) ); 
  72. update_option( $opt_jfb_api_sec, esc_html($_POST[$opt_jfb_api_sec]) ); 
  73. if( isset($_POST['main_opts_updated']) ) 
  74. $shownTab = 1; 
  75. update_option( $opt_jfb_ask_perms, esc_html( isset( $_POST[$opt_jfb_ask_perms] ) ? $_POST[$opt_jfb_ask_perms] : 0 ) ); 
  76. update_option( $opt_jfb_ask_stream, esc_html( isset( $_POST[$opt_jfb_ask_stream] ) ? $_POST[$opt_jfb_ask_stream] : 0 ) ); 
  77. update_option( $opt_jfb_wp_avatars, esc_html( isset( $_POST[$opt_jfb_wp_avatars] ) ? $_POST[$opt_jfb_wp_avatars] : 0 ) ); 
  78. update_option( $opt_jfb_stream_content, esc_html( isset( $_POST[$opt_jfb_stream_content] ) ? $_POST[$opt_jfb_stream_content] : '' ) );  
  79. update_option( $opt_jfb_show_credit, esc_html( isset( $_POST[$opt_jfb_show_credit] ) ? $_POST[$opt_jfb_show_credit] : 0 ) ); 
  80. update_option( $opt_jfb_email_to, esc_html( isset( $_POST[$opt_jfb_email_to] ) ? $_POST[$opt_jfb_email_to] : '' ) ); 
  81. update_option( $opt_jfb_email_logs, esc_html( isset( $_POST[$opt_jfb_email_logs] ) ? $_POST[$opt_jfb_email_logs] : 0 ) ); 
  82. update_option( $opt_jfb_email_logs_missingpost, esc_html( isset( $_POST[$opt_jfb_email_logs_missingpost] ) ? $_POST[$opt_jfb_email_logs_missingpost] : 0 ) ); 
  83. update_option( $opt_jfb_delay_redir, esc_html( isset( $_POST[$opt_jfb_delay_redir] ) ? $_POST[$opt_jfb_delay_redir] : 0 ) ); 
  84. update_option( $opt_jfb_fulllogerr, esc_html( isset( $_POST[$opt_jfb_fulllogerr] ) ? $_POST[$opt_jfb_fulllogerr] : 0 ) ); 
  85. update_option( $opt_jfb_disablenonce, esc_html( isset( $_POST[$opt_jfb_disablenonce] ) ? $_POST[$opt_jfb_disablenonce] : 0 ) ); 
  86. update_option( $opt_jfb_username_style, esc_html( isset( $_POST[$opt_jfb_username_style] ) ? $_POST[$opt_jfb_username_style] : 0 ) ); 
  87. update_option( $opt_jfb_reportstats, esc_html( isset( $_POST[$opt_jfb_reportstats] ) ? $_POST[$opt_jfb_reportstats] : 0 ) ); 
  88. ?><div class="updated"><p><strong><?php _e("Options saved", 'wp-fb-autoconnect')?></strong></p></div><?php  
  89. if( isset($_POST['prem_opts_updated']) && function_exists('jfb_update_premium_opts')) 
  90. $shownTab = 2; 
  91. jfb_update_premium_opts(); 
  92. if( isset($_POST['remove_all_settings']) ) 
  93. $shownTab = 0; 
  94. delete_option($opt_jfb_api_key); 
  95. delete_option($opt_jfb_api_sec); 
  96. delete_option($opt_jfb_email_to); 
  97. delete_option($opt_jfb_email_logs); 
  98. delete_option($opt_jfb_email_logs_missingpost); 
  99. delete_option($opt_jfb_delay_redir); 
  100. delete_option($opt_jfb_ask_perms); 
  101. delete_option($opt_jfb_ask_stream); 
  102. delete_option($opt_jfb_stream_content); 
  103. delete_option($opt_jfb_mod_done); 
  104. delete_option($opt_jfb_valid); 
  105. delete_option($opt_jfb_app_token); 
  106. delete_option($opt_jfb_bp_avatars); 
  107. delete_option($opt_jfb_wp_avatars); 
  108. delete_option($opt_jfb_fulllogerr); 
  109. delete_option($opt_jfb_disablenonce); 
  110. delete_option($opt_jfb_show_credit); 
  111. delete_option($opt_jfb_username_style); 
  112. delete_option($opt_jfb_hidesponsor); 
  113. delete_option($opt_jfb_hidew3warning); 
  114. delete_option($opt_jfb_hidewpenginewarning); 
  115. delete_option($opt_jfb_reportstats); 
  116. if( function_exists('jfb_delete_premium_opts') ) jfb_delete_premium_opts(); 
  117. ?><div class="updated"><p><strong><?php _e('All plugin settings have been cleared.', 'wp-fb-autoconnect' ); ?></strong></p></div><?php 
  118. ?> 
  119.  
  120. <?php  
  121. if( isset($_REQUEST[$opt_jfb_hidesponsor]) ) 
  122. update_option($opt_jfb_hidesponsor, esc_html($_REQUEST[$opt_jfb_hidesponsor])); 
  123. if(!get_option($opt_jfb_hidesponsor) && !defined('JFB_PREMIUM')): ?> 
  124. <!-- Sponsorship message *was* here, until Automattic demanded they be removed from all plugins - see http://gregsplugins.com/lib/2011/11/26/automattic-bullies/ --> 
  125. <?php endif; ?> 
  126.  
  127.  
  128. <!-- Tab Navigation --> 
  129. <?php  
  130. //Define some variables that'll be used for our tab-switching 
  131. $allTabsClass = "jfb_admin_tab"; 
  132. $allTabBtnsClass = "jfb_admin_tab_btn"; 
  133. $tabIds = array("jfb_admin_fbsetup", "jfb_admin_basicoptions", "jfb_admin_premiumoptions", "jfb_admin_uninstall", "jfb_admin_supportinfo"); 
  134. $tabNames = array(__("Facebook Setup", 'wp-fb-autoconnect'),  
  135. __("Basic Options", 'wp-fb-autoconnect'),  
  136. __("Premium Options", 'wp-fb-autoconnect'),  
  137. __("Uninstall", 'wp-fb-autoconnect'),  
  138. __("Support Info", 'wp-fb-autoconnect')); 
  139. ?> 
  140.  
  141. <script type="text/javascript"> 
  142. function jfb_swap_tabs(show_tab_num)  
  143. //Find the ID of the tab we want to show 
  144. var tabIds = <?php echo json_encode($tabIds);?>; 
  145. var show_tab_id = tabIds[show_tab_num]; 
  146.  
  147. //Hide all the tabs, then show just the one specified 
  148. jQuery(".<?php echo $allTabsClass ?>").hide(); 
  149. jQuery("#" + show_tab_id).show(); 
  150.  
  151. //Unhighlight all the tab buttons, then highlight just the one specified 
  152. jQuery(".<?php echo $allTabBtnsClass?>").attr("class", "<?php echo $allTabBtnsClass?>"); 
  153. jQuery("#" + show_tab_id + "_btn").addClass("jfb-admin_tab_selected"); 
  154.  
  155. //When the page is loaded, if there's a hash like "#1, #2, etc" in the URL, switch to that tab. 
  156. //This handles restoring the previously-displayed tab after a page refresh. 
  157. jQuery(document).ready(function()  
  158. if(window.location.hash) 
  159. var num = parseInt(window.location.hash.substr(1)); 
  160. if( !isNaN(num) ) 
  161. jfb_swap_tabs(num); 
  162. }); 
  163. </script> 
  164.  
  165. <div>  
  166. <ul class="jfb-admin_tabs"><?php 
  167. for($i=0; $i < count($tabIds); $i++) 
  168. ?><li id="<?php echo $tabIds[$i]?>_btn" class="<?php echo $allTabBtnsClass?> <?php echo ($shownTab==$i?"jfb-admin_tab_selected":"")?>"><a href="#<?php echo $i;?>" onclick="jfb_swap_tabs('<?php echo $i?>');"><?php echo $tabNames[$i];?></a></li><?php 
  169. ?></ul> 
  170. </div> 
  171.  
  172. <div class="jfb-admin_wrapper"> 
  173. <div class="<?php echo $allTabsClass ?>" id="<?php echo $tabIds[0]?>" style="display:<?php echo ($shownTab==0?"block":"none")?>"> 
  174. <h3><?php _e("Setup Instructions", 'wp-fb-autoconnect')?></h3> 
  175. <?php _e("To allow your users to login with their Facebook accounts, you must first setup a Facebook Application for your website:", 'wp-fb-autoconnect')?><br /><br /> 
  176. <ol> 
  177. <li><?php echo sprintf(__("Visit %s and click 'Add a New App.'", 'wp-fb-autoconnect'), "<a href='http://developers.facebook.com/apps' target='lnk'>developers.facebook.com/apps</a>")?></li> 
  178. <li><?php _e("When the 'Create a New App ID' window pops up, type in a name (i.e. the name of your site), contact e-mail, select a category, and click 'Create App ID.'", 'wp-fb-autoconnect')?></li> 
  179. <li><?php _e("Go to the 'Settings' page (link on the left), click 'Add Platform' (at the bottom), 'Website, ' then fill in your 'Site URL.'", 'wp-fb-autoconnect')?><br/> 
  180. <?php _e("Note: http://example.com/ and http://www.example.com/ are NOT the same.", 'wp-fb-autoconnect')?></li> 
  181. <li><?php _e("Also on the 'Settings' page, note the App ID and App Secret (you'll need them in a minute), and save changes.", 'wp-fb-autoconnect')?></li> 
  182. <li><?php _e("Go to the 'App Review' page (link on the left) and make the app public (flip the switch at the top).", 'wp-fb-autoconnect')?></li> 
  183. <li><?php _e("Copy the App ID and App Secret to the boxes below, and click the 'Connect' button.", 'wp-fb-autoconnect')?></li> 
  184. <li><?php echo sprintf(__("In your Wordpress admin panel, navigate to Appearance->Widgets (%s) and add the WP-FB AutoConnect widget to your sidebar.", 'wp-fb-autoconnect'), "<a href='".admin_url('widgets.php')."' target='widgets'><b>here</b></a>");?></li> 
  185. </ol> 
  186. <br /> 
  187. <?php echo sprintf(__("That's it - users should now be able to login to your blog with their Facebook accounts. For more complete documentation and help, please visit the %s plugin homepage %s.", 'wp-fb-autoconnect'), "<a target='moreinfo' href='$jfb_homepage'>", "</a>"); ?><br /> 
  188. <br /> 
  189. <hr /> 
  190.  
  191. <h3><?php _e("Facebook Connect", 'wp-fb-autoconnect')?></h3> 
  192. <form name="formFacebook" method="post" action=""> 
  193. <input type="text" size="40" name="<?php echo $opt_jfb_api_key?>" value="<?php echo get_option($opt_jfb_api_key) ?>" /> App ID<br /> 
  194. <input type="text" size="40" name="<?php echo $opt_jfb_api_sec?>" value="<?php echo get_option($opt_jfb_api_sec) ?>" /> App Secret 
  195. <input type="hidden" name="fb_opts_updated" value="1" /> 
  196. <div class="submit"><input type="submit" name="Submit" value="<?php _e("Connect", 'wp-fb-autoconnect')?>" /></div> 
  197. </form> 
  198. </div> <!-- End Tab --> 
  199.  
  200. <div class="<?php echo $allTabsClass ?>" id="<?php echo $tabIds[1]?>" style="display:<?php echo ($shownTab==1?"block":"none")?>"> 
  201. <?php 
  202. if(!get_option($opt_jfb_valid)) 
  203. echo "<div class=\"jfb-admin_warning\"><i><b>".__("You must enter a valid App ID and Secret under the 'Facebook Setup' tab before this plugin will function.", 'wp-fb-autoconnect')."</b></i></div>";  
  204. ?> 
  205. <h3><?php _e("Basic Options", 'wp-fb-autoconnect')?></h3> 
  206. <form name="formMainOptions" method="post" action=""> 
  207. <b><?php _e("Autoregistered Usernames", 'wp-fb-autoconnect')?>:</b><br /> 
  208. <input type="radio" name="<?php echo $opt_jfb_username_style; ?>" value="0" <?php echo (get_option($opt_jfb_username_style)==0?"checked='checked'":"")?> ><?php _e("Based on Facebook ID (i.e. FB_123456)", 'wp-fb-autoconnect')?><br /> 
  209. <input type="radio" name="<?php echo $opt_jfb_username_style; ?>" value="1" <?php echo (get_option($opt_jfb_username_style)==1?"checked='checked'":"")?> ><?php _e("Based on real name with prefix (i.e. FB_John_Smith)", 'wp-fb-autoconnect')?><br /> 
  210. <input type="radio" name="<?php echo $opt_jfb_username_style; ?>" value="3" <?php echo (get_option($opt_jfb_username_style)==3?"checked='checked'":"")?> ><?php _e("Based on real name without prefix (i.e. John_Smith)", 'wp-fb-autoconnect') . " <i><b>(" . __("Recommended for BuddyPress", 'wp-fb-autoconnect') . ")</b></i>";?><br /> 
  211. <input type="radio" name="<?php echo $opt_jfb_username_style; ?>" value="2" <?php echo (get_option($opt_jfb_username_style)==2?"checked='checked'":"")?> ><?php _e("Legacy Format (i.e. John.Smith)", 'wp-fb-autoconnect')?>  
  212. <i><b>(<?php _e("Not recommended", "wp-fb-autoconnect")?>)</b></i> <?php jfb_output_simple_lightbox("", __("Although the original 'BuddyPress-friendly' username format included a period, I later learned that this creates issues with author links in Wordpress. I've left the option here for legacy support, but advise against using it (unless you have only one author on your blog, in which case Facebook-connected users won't have author links and so it doesn't matter). If you do have multiple authors and are experiencing broken author links, changing this option will fix it for all NEW users, but you may want to consider fixing your existing users by replacing all of the '.'s with '_'s in the 'user_nicename' field of the 'wp_users' database table.", 'wp-fb-autoconnect')); ?><br /><br /> 
  213.  
  214. <b><?php _e("E-Mail", 'wp-fb-autoconnect')?>:</b><br /> 
  215. <input type="checkbox" name="<?php echo $opt_jfb_ask_perms?>" value="1" <?php echo get_option($opt_jfb_ask_perms)?'checked="checked"':''?> /> <?php _e("Request permission to get the connecting user's email address", 'wp-fb-autoconnect')?> 
  216. <?php jfb_output_simple_lightbox("", sprintf(__("Fetching your users' Facebook e-mail addresses will enable the plugin to give new (autoregistered) user accounts a valid e-mail. However, note that this is only a request - they may still deny permission in the Facebook login popup. If that happens, their autoregistered user account will be created with a 'placeholder' e-mail %s.<br/><br/>If you would like to require visiters to approve access to their e-mail before they're allowed to login, please check out the 'Request and REQUIRE' option under the Premium tab of the admin panel.", "wp-fb-autoconnect"), '(FB_<user_id>@unknown.com)')) ?><br /> 
  217.  
  218. <br /><b><?php _e("Announcement", 'wp-fb-autoconnect')?>:</b><br /> 
  219. <?php add_option($opt_jfb_stream_content, "has connected to " . get_option('blogname') . " with WP-FB AutoConnect."); ?> 
  220. <input type="checkbox" name="<?php echo $opt_jfb_ask_stream?>" value="1" <?php echo get_option($opt_jfb_ask_stream)?'checked="checked"':''?> /> <?php _e("Request permission to post the following announcement on users' Facebook walls when they connect for the first time:", 'wp-fb-autoconnect')?><br /> 
  221. <input type="text" size="80" name="<?php echo $opt_jfb_stream_content?>" value="<?php echo stripslashes(get_option($opt_jfb_stream_content)) ?>" /> 
  222. <?php jfb_output_simple_lightbox("", __("Unfortunately, Facebook has stopped granting this permission for new apps as of April 30 2015, effectively killing off this great feature. <b>The option will thus only function on sites that were already using it before.</b>", 'wp-fb-autoconnect'))?><br /> 
  223.  
  224. <br /><b><?php _e("Avatars", 'wp-fb-autoconnect')?>:</b><br /> 
  225. <input type="checkbox" name="<?php echo $opt_jfb_wp_avatars?>" value="1" <?php echo get_option($opt_jfb_wp_avatars)?'checked="checked"':''?> /> <?php _e("Use Facebook profile pictures as avatars", 'wp-fb-autoconnect')?><br /> 
  226.  
  227. <br /><b><?php _e("Appreciation", 'wp-fb-autoconnect')?>:</b><br /> 
  228. <input type="checkbox" name="<?php echo $opt_jfb_show_credit?>" value="1" <?php echo get_option($opt_jfb_show_credit)?'checked="checked"':''?> /> <?php _e("Display a 'Powered By' link in the blog footer (would be appreciated! :))", 'wp-fb-autoconnect')?><br /> 
  229. <input type="checkbox" name="<?php echo $opt_jfb_reportstats?>" value="1" <?php echo get_option($opt_jfb_reportstats)?'checked="checked"':''?> /> <?php _e("Periodically report usage stats to the plugin author", 'wp-fb-autoconnect')?> <?php jfb_output_simple_lightbox("", __("Reports include some very basic server info & a login count, to help me understand how & where the plugin is most used, and how I should focus my development. No names or e-mail addresses are sent.", 'wp-fb-autoconnect'));?><br /> 
  230.  
  231. <br /><b><?php _e("Debug", 'wp-fb-autoconnect')?>:</b><br /> 
  232. <?php add_option($opt_jfb_email_to, get_bloginfo('admin_email')); ?> 
  233. <input id="log_mainoption" type="checkbox" name="<?php echo $opt_jfb_email_logs?>" value="1" <?php echo get_option($opt_jfb_email_logs)?'checked="checked"':''?> /> <?php _e("Send event logs to:", 'wp-fb-autoconnect')?> <input type="text" size="40" name="<?php echo $opt_jfb_email_to?>" value="<?php echo get_option($opt_jfb_email_to) ?>" /> <?php jfb_output_simple_lightbox("", __("Event logs show detailed information about the login process, and are useful for debugging various types of issues. However, note that this option will send you an e-mail every time the login form is submitted - whether it's by a person or an automated spambot probing your site for vulnerabilities. The latter type of submission is very common and is nothing to worry about, as both Wordpress and this plugin have various types of security to prevent the bots from getting in. To avoid these spambot-generated messages, you may disable the suboption below.", 'wp-fb-autoconnect'));?><br /> 
  234. <input id="log_suboption" style="margin-left:20px;" type="checkbox" name="<?php echo $opt_jfb_email_logs_missingpost?>" value="1" <?php echo get_option($opt_jfb_email_logs_missingpost)?'checked="checked"':''?> /> ...<?php echo sprintf(__("Include '%s'errorevents", "wp-fb-autoconnect"), 'Missing POST Data')?><br /> 
  235. <input type="checkbox" name="<?php echo $opt_jfb_disablenonce?>" value="1" <?php echo get_option($opt_jfb_disablenonce)?'checked="checked"':''?> /> <?php _e("Disable nonce security check", 'wp-fb-autoconnect')?> (<?php _e("Not recommended", 'wp-fb-autoconnect')?>)<br /> 
  236. <input type="checkbox" name="<?php echo $opt_jfb_delay_redir?>" value="1" <?php echo get_option($opt_jfb_delay_redir)?'checked="checked"':''?> /> <?php _e("Delay redirect after login", 'wp-fb-autoconnect')?> (<i><u><?php _e("Not for production sites!", 'wp-fb-autoconnect')?></u></i>)<br /> 
  237. <input type="checkbox" name="<?php echo $opt_jfb_fulllogerr?>" value="1" <?php echo get_option($opt_jfb_fulllogerr)?'checked="checked"':''?> /> <?php _e("Show full log on error", 'wp-fb-autoconnect')?> (<i><u><?php _e("Not for production sites!", 'wp-fb-autoconnect')?></u></i>)<br /> 
  238. <script type="text/javascript"> 
  239. jQuery('#log_suboption').change(function() 
  240. if(jQuery(this).is(':checked')) 
  241. jQuery('#log_mainoption').prop('checked', true); 
  242. }); 
  243. jQuery('#log_mainoption').change(function() 
  244. if(!jQuery(this).is(':checked')) 
  245. jQuery('#log_suboption').prop('checked', false); 
  246. }); 
  247. </script> 
  248.  
  249. <input type="hidden" name="main_opts_updated" value="1" /> 
  250. <div class="submit"><input type="submit" name="Submit" value="<?php _e("Save", 'wp-fb-autoconnect')?>" /></div> 
  251. </form> 
  252. </div><!-- End Tab --> 
  253.  
  254. <div class="<?php echo $allTabsClass ?>" id="<?php echo $tabIds[2]?>" style="display:<?php echo ($shownTab==2?"block":"none")?>"> 
  255. <?php 
  256. if(!get_option($opt_jfb_valid)) 
  257. echo "<div class=\"jfb-admin_warning\"><i><b>" . __("You must enter a valid App ID and Secret under the 'Facebook Setup' tab before this plugin will function.", 'wp-fb-autoconnect')."</b></i></div>";  
  258. if( function_exists('jfb_output_premium_panel'))  
  259. jfb_output_premium_panel();  
  260. else 
  261. ?> 
  262. </div> <!-- End Tab --> 
  263.  
  264. <div class="<?php echo $allTabsClass ?>" id="<?php echo $tabIds[3]?>" style="display:<?php echo ($shownTab==3?"block":"none")?>"> 
  265. <h3><?php _e("Delete All Plugin Options", 'wp-fb-autoconnect')?></h3> 
  266. <?php _e("The following button will PERMANENTLY delete all of this plugin's options from your Wordpress database, as if it had never been installed. Use with care!", 'wp-fb-autoconnect')?> 
  267. <form name="formDebugOptions" method="post" action=""> 
  268. <input type="hidden" name="remove_all_settings" value="1" /> 
  269. <div class="submit"><input type="submit" name="Submit" value="<?php _e("Delete", 'wp-fb-autoconnect')?>" /></div> 
  270. </form> 
  271. </div> <!-- End Tab --> 
  272.  
  273. <div class="<?php echo $allTabsClass ?>" id="<?php echo $tabIds[4]?>" style="display:<?php echo ($shownTab==4?"block":"none")?>"> 
  274. <h3><?php _e("Support Information", 'wp-fb-autoconnect')?></h3> 
  275. <div style="width:600px;"> 
  276. <?php echo sprintf(__("Before submitting a support request, please make sure to carefully read all the documentation and FAQs on the %s plugin homepage %s. Every problem that's ever been reported has a solution posted there.", 'wp-fb-autoconnect'), "<a href='$jfb_homepage#faq' target='support'>", "</a>")?><br /><br />  
  277. <?php echo sprintf(__("If you do choose to submit a request, please do so via the %s plugin homepage %s, not on Wordpress.org (which I rarely check). Also, please specifically mention that you've tried it with all other plugins disabled and the default theme (see %s) and include the following information about your Wordpress environment:", 'wp-fb-autoconnect'), "<a href='$jfb_homepage#feedback' target='support'>", "</a>", "<a href='$jfb_homepage#faq100' target='faq100'>FAQ100</a>")?><br /><br /> 
  278. </div> 
  279. <textarea readonly="readonly" onclick="this.focus();this.select();" title="<?php _e("To copy the system info, click below then press Ctrl + C (PC) or Cmd + C (Mac)", "wp-fb-autoconnect")?>" style="width:800px; height:350px; font-family: Menlo, Monaco, monospace;"> 
  280. Server URL: <?php echo "http://" . $_SERVER["HTTP_HOST"] . "\n" ?> 
  281. Site URL: <?php echo get_bloginfo('url') . "\n" ?> 
  282. Wordpress URL: <?php echo get_bloginfo('wpurl') . "\n" ?> 
  283. Wordpress Version: <?php echo $GLOBALS['wp_version'] . "\n" ?> 
  284. BuddyPress Version: <?php echo (defined('BP_VERSION')?BP_VERSION:"Not Detected") . "\n"; ?> 
  285. Plugin Version: <?php echo $jfb_version . "\n" ?> 
  286. Premium Version: <?php echo (defined('JFB_PREMIUM_VER')?JFB_PREMIUM_VER:"Not Detected") . "\n";?> 
  287. Premium Number: <?php echo (defined('JFB_PREMIUM')?JFB_PREMIUM:"Not Detected") . "\n";?> 
  288. WP MultiSite: <?php echo (defined('WP_ALLOW_MULTISITE')?"Allowed":"Off") . " / " . (function_exists('is_multisite')?(is_multisite()?"Enabled":"Disabled"):"Undefined") . "\n"; ?> 
  289. WP Locale: <?php echo get_locale() . "\n";?> 
  290. WP Debug: <?php echo (defined('WP_DEBUG') && WP_DEBUG?"Yes":"No") . "\n"; ?> 
  291. WP Engine: <?php echo ((defined('WPMU_PLUGIN_DIR') && file_exists(WPMU_PLUGIN_DIR . "/wpengine-common/plugin.php"))?"Yes":"No") . "\n";?> 
  292. Facebook App: <?php echo (get_option($opt_jfb_app_id)?get_option($opt_jfb_app_id):"<Unset>") . "\n"?> 
  293. Facebook PHP API: <?php echo (class_exists('Facebook')?"Already present!":"OK") . "\n" ?> 
  294. Facebook Reachable: <?php  
  295. $result = wp_remote_get("https://graph.facebook.com/$jfb_apiver", array( 'sslverify' => false )); 
  296. if(is_wp_error($result)) echo "ERROR (wp_error - unreachable)\n"; 
  297. else if (NULL == json_decode($result['body'], true)) echo "ERROR (json_decode - invalid)\n"; 
  298. else echo "OK\n"; ?> 
  299. Facebook Graph: <?php echo $result['headers']['facebook-api-version'] . "\n";?> 
  300. Facebook Validated: <?php echo (get_option($opt_jfb_valid)?"OK":"NO")."\n";?> 
  301. Server: <?php echo substr($_SERVER['SERVER_SOFTWARE'], 0, 65) . (strlen($_SERVER['SERVER_SOFTWARE'])>65?"...":""); ?>  
  302. Browser: <?php $browser = jfb_get_browser(); echo $browser['shortname'] . " " . $browser['version'] . " for " . $browser['platform'] . "\n"; ?> 
  303. Theme: <?php echo wp_get_theme() . "\n"; ?> 
  304. Active Plugins: <?php $active_plugins = get_option('active_plugins'); 
  305. $plug_info=get_plugins(); 
  306. echo count($active_plugins) . "\n"; 
  307. foreach($active_plugins as $name) echo "-->" . $plug_info[$name]['Title']. " " . $plug_info[$name]['Version']."\n";?> 
  308. </textarea> 
  309. </div> <!-- End Tab --> 
  310.  
  311. </div><!-- div jfb-admin_wrapper -->  
  312. </div> <!-- div wrap --> 
  313. <?php