function id_activate_hooks()
{
    // warning that we don't support this version of WordPress
    if (version_compare(get_bloginfo('version'), ID_MIN_WP_VERSION, '<')) {
        add_action('admin_head', 'id_wordpress_version_warning');
        return;
    }
    // hooks onto incoming requests
    add_action('init', 'id_request_handler');
    // IntenseDebate individual settings
    add_action('admin_notices', 'id_admin_notices');
    // IntenseDebate server settings
    add_action('admin_menu', 'id_menu_items');
    add_action('init', 'id_process_settings_page');
    if (id_do_admin_hooks()) {
        // scripts for admin settings page
        add_action("admin_head", 'id_settings_head');
        // allow options.php to handle updates in WPMU and future WP versions
        add_filter('whitelist_options', 'id_whitelist_options');
        // add comment counts in best way available
        if (id_is_active()) {
            add_action('admin_print_footer_scripts', 'id_get_comment_footer_script', 21);
        }
    }
    if (is_admin()) {
        // Always add comment moderation count in the admin area
        add_action('admin_print_footer_scripts', 'id_admin_footer', 21);
    }
    if (id_is_active()) {
        // crud hooks
        add_action('wp_insert_comment', 'id_save_comment');
        add_action('trackback_post', 'id_save_comment');
        add_action('pingback_post', 'id_save_comment');
        add_action('edit_comment', 'id_save_comment');
        add_action('save_post', 'id_save_post');
        add_action('delete_post', 'id_delete_post');
        add_action('wp_set_comment_status', 'id_comment_status', 10, 2);
        add_action('trashed_comment', 'id_comment_trashed', 10);
        add_action('untrashed_comment', 'id_comment_untrashed', 10);
        // Settings > Discussion sync
        add_action('load-options.php', 'id_discussion_settings_page');
        // Load ID comment template
        if (0 == get_option('id_useIDComments')) {
            if (!id_is_mobile() || id_is_mobile() && 0 != get_option('id_revertMobile')) {
                add_filter('comments_template', 'id_comments_template');
                // swap out the comment count links
                add_filter('comments_number', 'id_get_comment_number');
                add_action('wp_footer', 'id_get_comment_footer_script', 21);
                add_action('get_footer', 'id_get_comment_footer_script', 100);
            }
        }
        // Disable email notifications properly
        add_filter('option_moderation_notify', create_function('$a', 'return 0;'));
        add_filter('option_comments_notify', create_function('$a', 'return 0;'));
    }
    if (id_is_active() || id_queue_not_empty()) {
        // fires the outgoing HTTP request queue for ID synching
        add_action('shutdown', 'id_ping_queue');
    }
}
<?php

// Custom IntenseDebate Comments template.
// Loads comments from the WordPress database using your own comments template,
// loads IntenseDebate UI for users with Javascript enabled.
if (get_option('id_revertMobile') == 0 && id_is_mobile()) {
    // Display the comments template from the active theme
    include get_option('id_comment_template_file');
} else {
    global $id_cur_post;
    $id_cur_post = $post;
    $bits = parse_url(WP_PLUGIN_URL);
    $xd_base = $bits['path'];
    id_auto_login();
    ?>
	<div id='idc-container'></div>
	<div id="idc-noscript">
		<p id="idc-unavailable"><?php 
    _e('This website uses <a href="http://intensedebate.com/">IntenseDebate comments</a>, but they are not currently loaded because either your browser doesn\'t support JavaScript, or they didn\'t load fast enough.', 'intensedebate');
    ?>
</p>
		<?php 
    // Include your theme's comemnt template
    if (is_readable(get_option("id_comment_template_file"))) {
        include get_option("id_comment_template_file");
    }
    ?>
	</div>
	<script type="text/javascript">
	/* <![CDATA[ */
	var idc_xd_receiver = '<?php 
<?php

// Custom IntenseDebate Comments template.
// Loads comments from the WordPress database using your own comments template,
// loads IntenseDebate UI for users with Javascript enabled.
if (0 == get_option('id_revertMobile') && id_is_mobile()) {
    // Display the comments template from the active theme
    id_get_original_comment_template();
} else {
    ?>
	<div id='idc-container'></div>
	<div id="idc-noscript">
		<?php 
    id_get_original_comment_template();
    ?>
	</div>
	<script type="text/javascript">
	/* <![CDATA[ */
	function IDC_revert() { document.getElementById('idc-loading-comments').style.display='none'; if ( !document.getElementById('IDCommentsHead') ) { document.getElementById('idc-noscript').style.display='block'; document.getElementById('idc-comment-wrap-js').parentNode.removeChild(document.getElementById('idc-comment-wrap-js')); } else { document.getElementById('idc-noscript').style.display='none'; } }
	idc_ns = document.getElementById('idc-noscript');
	idc_ns.style.display='none'; idc_ld = document.createElement('div');
	idc_ld.id = 'idc-loading-comments'; idc_ld.style.verticalAlign='middle';
	idc_ld.innerHTML = "<img src='<?php 
    echo plugins_url('loading.gif', __FILE__);
    ?>
' alt='Loading' border='0' align='absmiddle' /> <?php 
    _e('Loading IntenseDebate Comments...', 'intensedebate');
    ?>
";
	idc_ns.parentNode.insertBefore(idc_ld, idc_ns);
	setTimeout( IDC_revert, 10000 );