You are here

function disqus_footer in Disqus 5

Same name and namespace in other branches
  1. 6 disqus.module \disqus_footer()

Implementation of hook_footer().

Parameters

$disqus_options: The options to pass off to the Disqus comments.

1 call to disqus_footer()
theme_disqus_comments in ./disqus.module
Renders the JavaScript to display the Disqus thread for the current page.

File

./disqus.module, line 112

Code

function disqus_footer($main = 0, $disqus_options = NULL) {
  static $disqus = FALSE;
  if (isset($disqus_options)) {
    $disqus = $disqus_options;
  }
  if ($disqus) {
    $domain = variable_get('disqus_domain', '');
    if (!empty($domain)) {
      $output = '<script type="text/javascript">';
      if (isset($disqus['developer'])) {
        $output .= 'var disqus_developer = 1;';
      }
      $output .= 'var disqus_url = ' . drupal_to_js($disqus['url']) . ';';
      $output .= 'var disqus_title = ' . drupal_to_js($disqus['title']) . ';';
      $output .= 'var disqus_message = ' . drupal_to_js($disqus['message']) . ';';
      $output .= 'var disqus_identifier = ' . drupal_to_js($disqus['identifier']) . ';';
      global $user;
      if ($user->uid > 0) {
        $output .= 'var disqus_def_name = ' . drupal_to_js($user->name) . ';';
        $output .= 'var disqus_def_email = ' . drupal_to_js($user->mail) . ';';
      }
      $output .= "</script><script type='text/javascript' src='http://disqus.com/forums/{$domain}/embed.js'></script>";
      return $output;
    }
  }
}