function _modernizr_current_build in Modernizr 8
Same name and namespace in other branches
- 7.3 modernizr.module \_modernizr_current_build()
Helper function to pulls all tests from the current modernizr.js
1 call to _modernizr_current_build()
- modernizr_generate_url in ./
modernizr.admin.inc - Generates new Modernizr URL for admin interface Callback for 'admin/config/development/modernizr'.
File
- ./
modernizr.module, line 498 - Main module file for Modernizr
Code
function _modernizr_current_build() {
$tests =& drupal_static(__FUNCTION__);
if (!isset($tests)) {
$path = modernizr_get_path();
$path_parts = explode('/', $path);
$file = $path ? file_get_contents($path) : NULL;
$filename = $path_parts[count($path_parts) - 1];
$tests = array();
// $matches holds two items:
// - [0] the full URL
// - [1] a string containing the args captured in the parens vvvv
$build_url = preg_match('/http:\\/\\/modernizr.com\\/download\\/#-(.*)/', $file, $matches);
// Turn URL args into test entries for Drupal module
if (isset($matches[1])) {
$args_and_prefix = explode(':', $matches[1]);
$build_args = explode('-', $args_and_prefix[0]);
foreach ($build_args as $arg) {
$tests[] = $arg;
}
}
else {
// Modernizr must not be downloaded, return null.
return null;
}
}
return $tests;
}