function vw_get_dribbble_count($username)
 {
     $counter_key = 'vw_social_counter_dribbble';
     /**
      * Check for cached version
      */
     $pinterest = get_transient($counter_key);
     if ($pinterest !== false) {
         return $pinterest;
     }
     /**
      * Getting counter
      */
     $dribbble['page_url'] = 'https://dribbble.com/' . $username;
     $dribbble['count'] = null;
     $api_url = 'http://api.dribbble.com/' . $username;
     $data = vw_get_subscriber_counter($api_url);
     if (!is_wp_error($data)) {
         $json = json_decode($data);
         if (isset($json->url)) {
             $dribbble['page_url'] = $json->url;
         }
         if (isset($json->followers_count)) {
             $dribbble['count'] = $json->followers_count;
         }
     }
     /**
      * Save counter
      */
     return vw_save_social_counter($counter_key, $dribbble);
 }
 function vw_get_soundcloud_count($user, $client_id = 'e15ea601b7aeb07705020236871018e9')
 {
     $soundcloud = get_transient('vw_soundcloud_count');
     if ($soundcloud !== false) {
         return $soundcloud;
     }
     $api_url = 'http://api.soundcloud.com/users/' . $user . '.json?client_id=' . $client_id;
     $soundcloud['page_url'] = '#';
     $soundcloud['count'] = 0;
     $data = vw_get_subscriber_counter($api_url);
     if (!is_wp_error($data)) {
         $json = json_decode($data);
         if (isset($json->permalink_url)) {
             $soundcloud['page_url'] = $json->permalink_url;
         }
         if (isset($json->followers_count)) {
             $soundcloud['count'] = $json->followers_count;
         }
     }
     if (is_null($soundcloud['count'])) {
         $saved_soundcloud = get_option('vw_social_counter_soundcloud', array());
         if (!empty($saved_soundcloud['count']) && $saved_soundcloud['page_url'] == $soundcloud['page_url']) {
             // Restore previous counter
             $soundcloud['count'] = $saved_soundcloud['count'];
         } else {
             $soundcloud['count'] = 0;
         }
     }
     update_option('vw_social_counter_soundcloud', $soundcloud);
     set_transient('vw_soundcloud_count', $soundcloud, VW_CONST_SOCIAL_COUNTER_CACHE_EXPIRE);
     return $soundcloud;
 }
 function vw_get_vimeo_count($page_name)
 {
     $vimeo = get_transient('vw_vimeo_count');
     if ($vimeo !== false) {
         return $vimeo;
     }
     $api_url = 'http://vimeo.com/api/v2/channel/' . $page_name . '/info.json';
     $vimeo['page_url'] = '#';
     $vimeo['count'] = 0;
     $data = vw_get_subscriber_counter($api_url);
     if (!is_wp_error($data)) {
         $json = json_decode($data);
         if (isset($json->url)) {
             $vimeo['page_url'] = $json->url;
         }
         if (isset($json->plusOneCount)) {
             $vimeo['count'] = $json->plusOneCount;
         }
     }
     set_transient('vw_vimeo_count', $vimeo, VW_CONST_SOCIAL_COUNTER_CACHE_EXPIRE);
     return $vimeo;
 }