function angularjs_version_options in AngularJS 7
Returns a list of all current AngularJS versions
Parameters
boolean $reset Whether to reset the cache:
Return value
array
1 call to angularjs_version_options()
- angularjs_settings_form in ./
angularjs.admin.inc - AngularJS configuration form
File
- ./
angularjs.module, line 80
Code
function angularjs_version_options($reset = FALSE) {
$cid = 'angularjs:versions';
if (!$reset && ($cache = cache_get($cid)) && !empty($cache->data)) {
$data = $cache->data;
}
else {
$result = drupal_http_request('https://code.angularjs.org/');
$re = "/href=\"([0-9][0-9\\.a-z\\-]+)\\/\"/";
if (TRUE === isset($result->data)) {
preg_match_all($re, $result->data, $matches);
if ($matches && 2 == sizeof($matches)) {
$data = $matches[1];
cache_set($cid, $data);
}
}
}
return drupal_map_assoc($data);
}