You are here

public static function ShareaholicContentManager::single_domain_worker in Share Buttons, Related Posts, Content Analytics - Shareaholic 7.3

Same name and namespace in other branches
  1. 8 content_manager.php \ShareaholicContentManager::single_domain_worker()

Wrapper for the Shareaholic Content Manager Single Domain worker API

Parameters

string $domain:

2 calls to ShareaholicContentManager::single_domain_worker()
ShareaholicUtilities::get_or_create_api_key in ./utilities.php
Returns the api key or creates a new one.
shareaholic_enable in ./shareaholic.install
Implements hook_enable(). When the module is enabled, call CM single domain worker and log the enable event

File

./content_manager.php, line 21

Class

ShareaholicContentManager
An interface to the Shareaholic Content Manager API's

Code

public static function single_domain_worker($domain = NULL) {
  if ($domain == NULL) {
    $domain = $GLOBALS['base_url'];
  }
  if ($domain != NULL) {
    $single_domain_job_url = ShareaholicUtilities::CM_API_URL . '/jobs/single_domain';
    $data = '{"args":["' . $domain . '", {"force": true}]}';
    $options = array(
      'method' => 'POST',
      'data' => $data,
      'headers' => array(
        'Content-Type' => 'application/json',
      ),
    );
    $response = drupal_http_request($single_domain_job_url, $options);
  }
}