You are here

public static function ShareaholicContentManager::single_page_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_page_worker()

Wrapper for the Shareaholic Content Manager Single Page worker API

Parameters

Object $node The content that was created/updated/deleted:

3 calls to ShareaholicContentManager::single_page_worker()
shareaholic_node_delete in includes/node.php
Implements hook_node_delete(). When a node is deleted, notify CM
shareaholic_node_insert in includes/node.php
Implements hook_node_insert(). When a node is created, notify CM to scrape its details and clear FB cache
shareaholic_node_update in includes/node.php
Implements hook_node_update(). When a node is updated, notify CM to scrape its details and clear FB cache

File

./content_manager.php, line 43

Class

ShareaholicContentManager
An interface to the Shareaholic Content Manager API's

Code

public static function single_page_worker($node) {
  $page_link = url('node/' . $node->nid, array(
    'absolute' => TRUE,
  ));
  if (isset($page_link)) {
    $single_page_job_url = ShareaholicUtilities::CM_API_URL . '/jobs/uber_single_page';
    $data = '{"args":["' . $page_link . '", {"force": true}]}';
    $options = array(
      'method' => 'POST',
      'data' => $data,
      'headers' => array(
        'Content-Type' => 'application/json',
      ),
    );
    $response = drupal_http_request($single_page_job_url, $options);
  }
}