function xcomments_popup_link($zero = 'No Comments', $one = '1 Comment', $more = '% Comments', $CSSclass = '', $none = 'Comments Off', $echo = true)
 {
     $module_handler =& xoops_gethandler('module');
     $module =& $module_handler->getByDirname(wp_mod());
     $mid = $module->getVar('mid');
     $number = xoops_comment_count($mid, $GLOBALS['wp_post_id']);
     $xcomments_popup_link = "";
     if (0 == $number && 'closed' == $GLOBALS['post']->comment_status) {
         return _echo($none, $echo);
     } else {
         if (!empty($GLOBALS['post']->post_password)) {
             // if there's a password
             if ($_COOKIE['wp-postpass_' . $GLOBALS['cookiehash']] != $GLOBALS['post']->post_password) {
                 // and it doesn't match the cookie
                 return _echo("Enter your password to view comments", $echo);
             }
         }
         $xcomments_popup_link .= '<a href="';
         if (!empty($GLOBALS['wpcommentsjavascript'])) {
             $xcomments_popup_link .= wp_siteurl() . '/' . $GLOBALS['wpcommentspopupfile'] . '?p=' . $GLOBALS['wp_post_id'] . '&amp;c=1';
             $xcomments_popup_link .= '" onclick="wpopen(this.href); return false"';
         } else {
             // if comments_popup_script() is not in the template, display simple comment link
             $xcomments_popup_link .= xcomments_link('', false);
             $xcomments_popup_link .= '"';
         }
         if (!empty($CSSclass)) {
             $xcomments_popup_link .= ' class="' . $CSSclass . '"';
         }
         $xcomments_popup_link .= '>';
         $xcomments_popup_link .= comments_number($zero, $one, $more, $number, false);
         $xcomments_popup_link .= '</a>';
         return _echo($xcomments_popup_link, $echo);
     }
 }
function xcomments_popup_link($zero = 'No Comments', $one = '1 Comment', $more = '% Comments', $CSSclass = '', $none = 'Comments Off')
{
    global $wp_post_id, $wpcommentspopupfile, $wpcommentsjavascript, $post, $wpdb, $cookiehash, $wp_id;
    global $siteurl, $xoopsDB, $xoopsModule, $wp_mod;
    $module_handler =& xoops_gethandler('module');
    $module =& $module_handler->getByDirname($wp_mod[$wp_id]);
    $mid = $module->getVar('mid');
    $number = xoops_comment_count($mid, $wp_post_id);
    if (0 == $number && 'closed' == $post->comment_status) {
        echo $none;
        return;
    } else {
        if (!empty($post->post_password)) {
            // if there's a password
            if ($_COOKIE['wp-postpass_' . $cookiehash] != $post->post_password) {
                // and it doesn't match the cookie
                echo "Enter your password to view comments";
                return;
            }
        }
        echo '<a href="';
        if ($wpcommentsjavascript) {
            echo $siteurl . '/' . $wpcommentspopupfile . '?p=' . $wp_post_id . '&amp;c=1';
            //echo get_permalink();
            echo '" onclick="wpopen(this.href); return false"';
        } else {
            // if comments_popup_script() is not in the template, display simple comment link
            xcomments_link();
            echo '"';
        }
        if (!empty($CSSclass)) {
            echo ' class="' . $CSSclass . '"';
        }
        echo '>';
        comments_number($zero, $one, $more, $number);
        echo '</a>';
    }
}