Esempio n. 1
0
/**
* Disable internal Wordpress commenting if Disqus is enabled - this prevents spam bots from
* commenting using POST requests to /wp-comments-post.php.
*
* @param int $comment_post_ID
* @return int
*/
function dsq_pre_comment_on_post($comment_post_ID)
{
    if (dsq_can_replace()) {
        wp_die(dsq_i('Sorry, the built-in commenting system is disabled because Disqus is active.'));
    }
    return $comment_post_ID;
}
Esempio n. 2
0
function dsq_comments_number($comment_text)
{
    global $post;
    if (dsq_can_replace()) {
        return '<span class="dsq-postid-' . $post->ID . '">View Comments</span>';
    } else {
        return $comment_text;
    }
}
 function tc_disqus_comments_enabled()
 {
     return function_exists('dsq_is_installed') && function_exists('dsq_can_replace') && dsq_is_installed() && dsq_can_replace();
 }
Esempio n. 4
0
function dsq_comments_number($comment_text)
{
    global $post;
    if (dsq_can_replace()) {
        return '<span class="dsq-postid" rel="' . htmlspecialchars(dsq_identifier_for_post($post)) . '">View Comments</span>';
    } else {
        return $comment_text;
    }
}
Esempio n. 5
0
function dsq_comments_number($comment_text)
{
    if (dsq_can_replace()) {
        ob_start();
        the_permalink();
        $the_permalink = ob_get_contents();
        ob_end_clean();
        return '</a><noscript><a href="http://' . strtolower(get_option('disqus_forum_url')) . '.' . DISQUS_DOMAIN . '/?url=' . $the_permalink . '">View comments</a></noscript><a href="' . $the_permalink . '#disqus_thread">Comments</a>';
    } else {
        return $comment_text;
    }
}
Esempio n. 6
0
function dsq_output_footer_comment_js()
{
    if (!dsq_can_replace()) {
        return;
    }
    if (get_option('disqus_cc_fix') != '1') {
        return;
    }
    ?>
    <script type="text/javascript">
    // <![CDATA[
        var disqus_shortname = '<?php 
    echo strtolower(get_option('disqus_forum_url'));
    ?>
';
        var disqus_domain = '<?php 
    echo DISQUS_DOMAIN;
    ?>
';
        (function () {
            var nodes = document.getElementsByTagName('span');
            for (var i = 0, url; i < nodes.length; i++) {
                if (nodes[i].className.indexOf('dsq-postid') != -1) {
                    nodes[i].parentNode.setAttribute('data-disqus-identifier', nodes[i].getAttribute('rel'));
                    url = nodes[i].parentNode.href.split('#', 1);
                    if (url.length == 1) url = url[0];
                    else url = url[1]
                    nodes[i].parentNode.href = url + '#disqus_thread';
                }
            }
            var s = document.createElement('script'); s.async = true;
            s.type = 'text/javascript';
            s.src = 'http://' + disqus_domain + '/forums/' + disqus_shortname + '/count.js';
            (document.getElementsByTagName('HEAD')[0] || document.getElementsByTagName('BODY')[0]).appendChild(s);
        }());
    //]]>
    </script>
<?php 
}