You are here

public function ShareaholicShareCount::odnoklassniki_count_callback in Share Buttons, Related Posts, Content Analytics - Shareaholic 7.3

Same name and namespace in other branches
  1. 8 lib/social-share-counts/share_count.php \ShareaholicShareCount::odnoklassniki_count_callback()

Callback function for odnoklassniki count API Gets the odnoklassniki counts from response

Parameters

Array $response The response from calling the API:

Return value

mixed The counts from the API or false if error

File

lib/social-share-counts/share_count.php, line 246

Class

ShareaholicShareCount
An abstract class Share Counts to be extended

Code

public function odnoklassniki_count_callback($response) {
  if ($this
    ->has_http_error($response)) {
    return false;
  }

  // Another weird API. Similar to vk, extract the 2nd param from the response:
  // 'ODKL.updateCount('odklcnt0','14198');'
  $matches = array();
  preg_match('/^ODKL\\.updateCount\\(\'odklcnt0\',\'(\\d+)\'\\);$/i', $response['body'], $matches);
  return isset($matches[1]) ? intval($matches[1]) : false;
}