コード例 #1
0
 function get_thread_info($post)
 {
     $identifier = dsq_identifier_for_post($post);
     $title = dsq_title_for_post($post);
     $response = $this->api->thread_by_identifier(array('identifier' => $identifier, 'title' => $title));
     return $response->thread;
 }
コード例 #2
0
ファイル: disqus.php プロジェクト: VizualAbstract/Marilyn
function dsq_update_permalink($post)
{
    global $dsq_api;
    if (DISQUS_DEBUG) {
        echo "updating post on disqus: {$post->ID}\n";
    }
    $response = $dsq_api->api->update_thread(null, array('thread_identifier' => dsq_identifier_for_post($post), 'title' => dsq_title_for_post($post), 'url' => dsq_link_for_post($post)));
    $cleaned_thread_id = sanitize_meta('dsq_thread_id', $response->id, 'post');
    update_post_meta($post->ID, 'dsq_thread_id', $cleaned_thread_id);
    return $response;
}
コード例 #3
0
';
    var disqus_identifier = '<?php 
echo dsq_identifier_for_post($post);
?>
';
    var disqus_container_id = 'disqus_thread';
    var disqus_domain = '<?php 
echo DISQUS_DOMAIN;
?>
';
    var disqus_shortname = '<?php 
echo strtolower(get_option('disqus_forum_url'));
?>
';
    var disqus_title = <?php 
echo cf_json_encode(dsq_title_for_post($post));
?>
;
    <?php 
if (false && get_option('disqus_developer')) {
    ?>
        var disqus_developer = 1;
    <?php 
}
?>
    var disqus_config = function () {
        var config = this; // Access to the config object

        /* 
           All currently supported events:
            * preData — fires just before we request for initial data
コード例 #4
0
function dsq_update_permalink($post)
{
    global $dsq_api;
    $response = $dsq_api->api->update_thread(null, array('thread_identifier' => dsq_identifier_for_post($post), 'title' => dsq_title_for_post($post), 'url' => dsq_link_for_post($post)));
    return $response;
}
コード例 #5
0
ファイル: comments.php プロジェクト: pombredanne/ArcherSys
}

if ( get_option('dsq_external_js') == '1' ) {
    wp_register_script( 'dsq_embed_script', plugins_url( '/media/js/disqus.js', __FILE__ ) );
    wp_localize_script( 'dsq_embed_script', 'embedVars', $embed_vars );
    wp_enqueue_script( 'dsq_embed_script', plugins_url( '/media/js/disqus.js', __FILE__ ) );
}
else {

?>
<script type="text/javascript">
var disqus_url = '<?php echo get_permalink(); ?>';
var disqus_identifier = '<?php echo dsq_identifier_for_post($post); ?>';
var disqus_container_id = 'disqus_thread';
var disqus_shortname = '<?php echo strtolower(get_option('disqus_forum_url')); ?>';
var disqus_title = <?php echo cf_json_encode( dsq_title_for_post($post) ); ?>;
var disqus_config_custom = window.disqus_config;
var disqus_config = function () {
    /*
    All currently supported events:
    onReady: fires when everything is ready,
    onNewComment: fires when a new comment is posted,
    onIdentify: fires when user is authenticated
    */
    
    <?php
    $sso = dsq_sso();
    if ($sso) {
        foreach ($sso as $k=>$v) {
            echo 'this.page.' . esc_js($k) . ' = \'' . esc_js($v) . '\';';
            echo "\n";
コード例 #6
0
function dsq_update_permalink($post)
{
    global $dsq_api;
    if (DISQUS_DEBUG) {
        echo "updating post on disqus: {$post->ID}\n";
    }
    $response = $dsq_api->api->update_thread(null, array('thread_identifier' => dsq_identifier_for_post($post), 'title' => dsq_title_for_post($post), 'url' => dsq_link_for_post($post)));
    //Make sure that response exists so that warnings are not thrown
    if (!empty($response)) {
        $cleaned_thread_id = sanitize_meta('dsq_thread_id', $response->id, 'post');
        update_post_meta($post->ID, 'dsq_thread_id', $cleaned_thread_id);
    }
    return $response;
}
コード例 #7
0
                </div>
            </div><!-- .navigation -->
<?php 
    }
    // check for comment navigation
    ?>

        </div>

    <?php 
}
?>
</div>

<?php 
global $wp_version;
$embed_vars = array('disqusConfig' => array('platform' => 'wordpress@' . $wp_version, 'language' => apply_filters('disqus_language_filter', '')), 'disqusIdentifier' => dsq_identifier_for_post($post), 'disqusShortname' => strtolower(get_option('disqus_forum_url')), 'disqusTitle' => dsq_title_for_post($post), 'disqusUrl' => get_permalink(), 'options' => array('manualSync' => get_option('disqus_manual_sync')), 'postId' => $post->ID);
// Add SSO vars if enabled
$sso = dsq_sso();
if ($sso) {
    global $current_site;
    foreach ($sso as $k => $v) {
        $embed_vars['disqusConfig'][$k] = $v;
    }
    $siteurl = site_url();
    $sitename = get_bloginfo('name');
    $embed_vars['disqusConfig']['sso'] = array('name' => wp_specialchars_decode($sitename, ENT_QUOTES), 'button' => get_option('disqus_sso_button'), 'url' => $siteurl . '/wp-login.php', 'logout' => $siteurl . '/wp-login.php?action=logout', 'width' => '800', 'height' => '700');
}
wp_register_script('dsq_embed_script', plugins_url('/media/js/disqus.js', __FILE__));
wp_localize_script('dsq_embed_script', 'embedVars', $embed_vars);
wp_enqueue_script('dsq_embed_script', plugins_url('/media/js/disqus.js', __FILE__));