drupal_build_js_cache
includes/common.inc, строка 2360
- Версии
- 6
drupal_build_js_cache($files, $filename)
Объединяет JS файлы, размещая конечный файл в файловой директории.
Параметры
$files
Массив с JS файлами для объединения и сжатия в один файл.
$filename
Имя объединенного JS файла.
Возвращаемое значение
Имя JS файла.
Код
<?php
function drupal_build_js_cache($files, $filename) {
$contents = '';
// Create the js/ within the files folder.
$jspath = file_create_path('js');
file_check_directory($jspath, FILE_CREATE_DIRECTORY);
if (!file_exists($jspath .'/'. $filename)) {
// Build aggregate JS file.
foreach ($files as $path => $info) {
if ($info['preprocess']) {
// Append a ';' after each JS file to prevent them from running together.
$contents .= file_get_contents($path) .';';
}
}
// Create the JS file.
file_save_data($contents, $jspath .'/'. $filename, FILE_EXISTS_REPLACE);
}
return $jspath .'/'. $filename;
}
?>
Войдите или зарегистрируйтесь, чтобы получить возможность отправлять комментарии