You are here

function disqus_api in Disqus 7

Same name and namespace in other branches
  1. 8 disqus.module \disqus_api()

Creates an instance of the Disqus PHP API.

Return value

The instance of the Disqus API.

2 calls to disqus_api()
disqus_node_delete in ./disqus.module
Implements hook_node_delete().
disqus_node_update in ./disqus.module
Implements hook_node_update().

File

./disqus.module, line 867
The Disqus Drupal module.

Code

function disqus_api() {
  if (module_exists('libraries') && ($library = libraries_load('disqusapi')) && !empty($library['loaded'])) {
    try {
      $disqus = new DisqusAPI(variable_get('disqus_secretkey', ''));
    } catch (Exception $exception) {
      drupal_set_message(t('There was an error loading the Disqus PHP API. Please check your API keys and try again.'), 'error');
      watchdog('disqus', 'Error loading the Disqus PHP API. Check your API keys.', array(), WATCHDOG_ERROR, 'admin/config/services/disqus');
      return FALSE;
    }
    return $disqus;
  }
  return FALSE;
}