post->ID; // Return out of function if commenting is closed for this post if (!comments_open()) { echo "

Comments Closed

"; return $comments; } $xid = $fbc_options['xid'] . "_post$postId"; $postTitle = get_the_title($postId); $postUrl = get_permalink($postId); // Decide which stylesheet to use $customStylesheet = fbComments_getStylesheet(); // Only insert the Facebook comments if both an application ID and an application secret has been set if (!empty($fbc_options['appId']) && !empty($fbc_options['appSecret'])) { // Store our access token if it hasn't already been saved fbComments_storeAccessToken(); echo "\n\n \n"; if ($fbc_options['includeFbJs']) { fbComments_includeFbJs(); } // Print out the JavaScript that will catch new comments in order to update comment counts and send notifications fbComments_printCommentCatchAndNotificationScripts($xid, $postTitle, $postUrl); echo "\n
\n"; if ($fbc_options['displayTitle']) { echo "\t

" . __($fbc_options['title']) . "

\n"; } // Print out the JavaScript for calculating the width of the comments box fbComments_printFbCommentsTag($xid, $postTitle, $postUrl, $customStylesheet); // Hide the WordPress commenting form if requested if ($fbc_options['hideWpComments']) { return array(); // Must return an empty array so foreach() loops in certain themes don't produce errors } } else { // If no application ID or application secret are set, display a message asking the user to set one (if they have permission to do so) fbComments_handleNoAppId(); } return $comments; } /********************************** Facebook comments box helpers **********************************/ function fbComments_getStylesheet() { global $fbc_options; if (($fbc_options['darkSite'])) { return FBCOMMENTS_CSS_HIDELIKEANDDARKSITE . '?' . fbComments_getRandXid(); } else { return FBCOMMENTS_CSS_HIDELIKE . '?' . fbComments_getRandXid(); } } function fbComments_handleNoAppId() { global $fbc_options; get_currentuserinfo(); // Get user info to see if the currently logged in user (if any) has the 'manage_options' capability if (current_user_can('manage_options')) { $fbc_optionsPage = admin_url('options-general.php?page=facebook-comments'); echo "\n
\n"; if ($fbc_options['displayTitle']) { echo "\t

" . __($fbc_options['title']) . "

\n"; } echo "\t
" . __("Your Facebook comments would normally appear here, but you haven't set a valid application ID or application secret yet. Go set them now.") . "
\n"; } } function fbComments_includeFbJs() { global $fbc_options; // Decide whether or not to include the Facebook JavaScript library the old way or the new way if ($fbc_options['includeFbJsOldWay']) { echo "\n
\n"; } else { echo "\n
\n"; } } function fbComments_printCommentCatchAndNotificationScripts($xid, $postTitle, $postUrl) { global $fbc_options; echo " \n"; } function fbComments_printFbCommentsTag($xid, $postTitle, $postUrl, $customStylesheet) { global $fbc_options; // Since the 'publish_feed' option defaults to true, we need to pass it an explicit false if it's turned off $publishToWall = ($fbc_options['publishToWall']) ? 'true' : 'false'; // if ($fbc_options['newUser'] == 1) { // echo "\t"; // } $siteisdark = ''; if ($fbc_options['darkSite'] == true) $siteisdark = "colorscheme='dark'"; if (!$fbc_options['hideFbLikeButton']) { $likebtn = ""; } else $likebtn = ''; if ($fbc_options['v1plusv2'] == 1) { echo "\n"; update_option('fbComments', $fbc_options); echo $likebtn,"\n"; echo "\t
"; echo "\t"; } else if ($fbc_options['commentVersion'] == 'v2migrated') { // $newpostUrl = urlencode(urlencode($postUrl)); echo "\n"; echo $likebtn,"\n"; echo "\t"; } else if ($fbc_options['commentVersion'] == 'v2') { echo "\n"; echo $likebtn,"\n"; echo "\t"; } else if ($fbc_options['commentVersion'] == 'v1') { echo "\n"; echo $likebtn,"\n"; echo "\t"; } echo "
\n"; } /** * Show like button before the_excerpt * * @since 3.1 */ function fbc_show_like_index($content) { global $fbc_options, $wp_query; wp_reset_query(); # so is_home always works if (!is_home()) return $content; $postUrl = get_permalink($wp_query->post->ID); $likebtn = ""; if ($fbc_options['indexLikebtn']['display'] == 'top') return $likebtn.$content; return $content.$likebtn; } /** * Show facebook iframe comment count * * @since 3.1 */ function fbc_facebook_comment_count($ccount='') { global $fbc_options, $wp_query; $postUrl = get_permalink($wp_query->post->ID); echo ""; // echo "\tcmt comments"; }