function _d3_list_library_versions_from_cdn in d3.js 7
Lists library versions by polling CDN
1 call to _d3_list_library_versions_from_cdn()
- d3_config_form in ./
d3.admin.inc - D3 configuration form
File
- ./
d3.module, line 88 - D3 module file for creating visualizations with d3.js.
Code
function _d3_list_library_versions_from_cdn() {
$library_versions = array();
if (checkdnsrr('d3js.org')) {
stream_context_set_default(array(
'https' => array(
'method' => 'HEAD',
),
));
for ($library_version = 3; $library_version < 50; ++$library_version) {
$hdrs = get_headers("https://d3js.org/d3.v{$library_version}.min.js");
if ($hdrs) {
if (substr($hdrs[0], 9, 1) === '2') {
$library_versions[] = "{$library_version}";
continue;
}
}
if (count($library_versions) != 0) {
break;
}
}
stream_context_set_default(array(
'https' => array(
'method' => 'GET',
),
));
}
return $library_versions;
}