function jfb_output_facebook_btn() { //Make sure the plugin has been setup global $jfb_name, $jfb_version, $jfb_js_callbackfunc, $opt_jfb_valid; global $opt_jfb_ask_perms, $opt_jfb_ask_stream, $opt_jfbp_requirerealmail; echo "<!-- {$jfb_name} Button v{$jfb_version} -->\n"; if (!get_option($opt_jfb_valid)) { echo "<!--WARNING: Invalid or Unset Facebook API Key-->"; return; } //Figure out our scope (aka extended permissions) $email_perms = get_option($opt_jfb_ask_perms) || get_option($opt_jfbp_requirerealmail); $stream_perms = get_option($opt_jfb_ask_stream); if ($email_perms && $stream_perms) { $scope = 'email,publish_stream'; } else { if ($email_perms) { $scope = 'email'; } else { if ($stream_perms) { $scope = 'publish_stream'; } else { $scope = ''; } } } $scope = apply_filters('wpfb_extended_permissions', $scope); //Output the button for the Premium version. NOTE: This will not work with pre-v30 Premium addons. if (defined('JFB_PREMIUM_VER') && function_exists('jfb_output_facebook_btn_premium_30')) { jfb_output_facebook_btn_premium_30($scope); } else { if (!defined('JFB_PREMIUM_VER')) { ?> <span class="fbLoginButton"><script type="text/javascript">//<!-- document.write('<fb:login-button scope="<?php echo $scope; ?> " v="2" size="small" onlogin="******"><?php echo apply_filters('wpfb_button_text', 'Login with Facebook'); ?> </fb:login-button>'); //--></script></span><?php } } //Run action do_action('wpfb_after_button'); }
function jfb_output_facebook_btn($callbackName = 0) { //Make sure the plugin has been setup global $jfb_name, $jfb_version, $jfb_js_callbackfunc, $opt_jfb_valid; global $opt_jfb_ask_perms, $opt_jfb_ask_stream, $opt_jfbp_requirerealmail; echo "<!-- {$jfb_name} Button v{$jfb_version} -->\n"; if (!get_option($opt_jfb_valid)) { echo "<!--WARNING: Invalid or Unset Facebook API Key-->"; return; } //If a callback name is explicitly specified, use that. Otherwise, use the global (main) callback. if (!$callbackName) { $callbackName = $jfb_js_callbackfunc; } //Figure out our scope (aka extended permissions) $email_perms = get_option($opt_jfb_ask_perms) || get_option($opt_jfbp_requirerealmail); $stream_perms = get_option($opt_jfb_ask_stream); if ($email_perms && $stream_perms) { $scope = 'email,publish_stream'; } else { if ($email_perms) { $scope = 'email'; } else { if ($stream_perms) { $scope = 'publish_stream'; } else { $scope = ''; } } } $scope = apply_filters('wpfb_extended_permissions', $scope); //Output the button for the Premium version. NOTE: This will not work with pre-v30 Premium addons. if (defined('JFB_PREMIUM_VER') && function_exists('jfb_output_facebook_btn_premium_30')) { //The $callbackName param was introduced to this fxn in v3.1.4. In order to avoid having to simultaneously //update both the premium addon and the core plugin, I'm gonna use this kinda "hacky" way to tell the addon //about the $callbackName. If no $callbackName param was specified, it'll be the same as $jfb_js_callbackfunc //(aka the global option), so this save-and-restore approach will have no effect. $savedGlobalCallback = $jfb_js_callbackfunc; $jfb_js_callbackfunc = $callbackName; jfb_output_facebook_btn_premium_30($scope); $jfb_js_callbackfunc = $savedGlobalCallback; } else { if (!defined('JFB_PREMIUM_VER')) { ?> <span class="fbLoginButton"><script type="text/javascript">//<!-- document.write('<fb:login-button scope="<?php echo $scope; ?> " v="2" size="small" onlogin="******"><?php echo apply_filters('wpfb_button_text', 'Login with Facebook'); ?> </fb:login-button>'); //--></script></span><?php } } //Run action do_action('wpfb_after_button'); }