You are here

function _get_lib_info in Easychart 7.2

Same name and namespace in other branches
  1. 7.3 drush/easychart.drush.inc \_get_lib_info()
2 calls to _get_lib_info()
easychart_drush_dependencies in drush/easychart.drush.inc
easychart_requirements in ./easychart.install

File

./easychart.module, line 805
Easychart module file.

Code

function _get_lib_info($lib) {
  switch ($lib) {
    case 'highcharts':
      $url = 'https://api.github.com/repos/highslide-software/highcharts.com/tags';

      // no release-info on https://api.github.com/repos/highslide-software/highcharts.com/releases
      $ch = curl_init($url);
      curl_setopt($ch, CURLOPT_TIMEOUT, 5);
      curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5);
      curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
      curl_setopt($ch, CURLOPT_USERAGENT, 'highslide-software/highcharts.com');
      $data = curl_exec($ch);
      curl_close($ch);
      break;
    case 'easychart':
      $url = 'https://api.github.com/repos/bestuurszaken/easychart/releases';
      $ch = curl_init($url);
      curl_setopt($ch, CURLOPT_TIMEOUT, 5);
      curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5);
      curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
      curl_setopt($ch, CURLOPT_USERAGENT, 'bestuurszaken/easychart');
      $data = curl_exec($ch);
      curl_close($ch);
      break;
    default:
      drush_log(dt('No library chosen.'), 'error');
      return false;
  }
  $output = array();
  $output['current_lib_info'] = libraries_detect($lib);

  /* if ($data) {
       $output['available'] = json_decode($data);
     } */
  return $output;
}