Exemplo n.º 1
0
function wordbb_comments_popup_link($zero = false, $one = false, $more = false, $css_class = '', $none = false)
{
    global $wordbb, $id, $wpcommentspopupfile, $wpcommentsjavascript, $post;
    $bridge = wordbb_get_bridge(WORDBB_POST, $id);
    if ($bridge) {
        $tid = $bridge->mybb_id;
        if (false === $zero) {
            $zero = __('No Comments');
        }
        if (false === $one) {
            $one = __('1 Comment');
        }
        if (false === $more) {
            $more = __('% Comments');
        }
        if (false === $none) {
            $none = __('Comments Off');
        }
        $number = get_comments_number($id);
        if (0 == $number && !comments_open() && !pings_open()) {
            echo '<span' . (!empty($css_class) ? ' class="' . esc_attr($css_class) . '"' : '') . '>' . $none . '</span>';
            return;
        }
        if (post_password_required()) {
            echo __('Enter your password to view comments');
            return;
        }
        echo '<a href="';
        if (get_option('wordbb_use_mybb_comments') == 'on' && get_option('wordbb_show_mybb_comments') != 'on' && !empty($tid)) {
            wordbb_thread_link();
            echo '"';
        } else {
            if ($wpcommentsjavascript) {
                if (empty($wpcommentspopupfile)) {
                    $home = get_option('home');
                } else {
                    $home = get_option('siteurl');
                }
                echo $home . '/' . $wpcommentspopupfile . '?comments_popup=' . $id;
                echo '" onclick="wpopen(this.href); return false"';
            } else {
                // if comments_popup_script() is not in the template, display simple comment link
                if (0 == $number) {
                    echo get_permalink() . '#respond';
                } else {
                    comments_link();
                }
                echo '"';
            }
        }
        if (!empty($css_class)) {
            echo ' class="' . $css_class . '"';
        }
        $title = attribute_escape(apply_filters('the_title', get_the_title()));
        echo ' title="' . sprintf(__('Comment on %s'), $title) . '">';
        comments_number($zero, $one, $more, $number);
        echo '</a>';
        echo '&nbsp;';
    } else {
        comments_popup_link($zero, $one, $more, $none);
    }
}
Exemplo n.º 2
0
function wordbb_comment_reply_link($link, $args, $comment, $post)
{
    global $wordbb;
    extract($args, EXTR_SKIP);
    $bridge = wordbb_get_bridge(WORDBB_POST, $post->ID);
    if (!empty($bridge)) {
        $tid = $bridge->mybb_id;
        $pid = $wordbb->posts[$tid][$wordbb->last_comment]->pid;
        $url = $wordbb->mybb_url . '/newreply.php?tid=' . $tid . '&pid=' . $pid . '#pid' . $pid;
        $link = "<a rel='nofollow' class='comment-reply-link' href='{$url}'>{$reply_text}</a>";
    }
    return $before . $link . $after;
}