Bumped the version up to 1.9.3
[moodle.git] / lib / javascript-mod.php
blob35e59eff067f6b43bdb01a71ddcf17fd199a7bc2
1 <?php /// $Id$
3 /// Searches modules, filters and blocks for any Javascript files
4 /// that should be called on every page
6 $nomoodlecookie = true;
8 include('../config.php');
10 $output = "// Javascript from Moodle modules\n";
12 if ($mods = get_list_of_plugins('mod')) {
13 foreach ($mods as $mod) {
14 if (is_readable($CFG->dirroot.'/mod/'.$mod.'/javascript.php')) {
15 $output .= file_get_contents($CFG->dirroot.'/mod/'.$mod.'/javascript.php');
20 if ($filters = get_list_of_plugins('filter')) {
21 foreach ($filters as $filter) {
22 if (is_readable($CFG->dirroot.'/filter/'.$filter.'/javascript.php')) {
23 $output .= file_get_contents($CFG->dirroot.'/filter/'.$filter.'/javascript.php');
28 if ($blocks = get_list_of_plugins('blocks')) {
29 foreach ($blocks as $block) {
30 if (is_readable($CFG->dirroot.'/blocks/'.$block.'/javascript.php')) {
31 $output .= file_get_contents($CFG->dirroot.'/blocks/'.$block.'/javascript.php');
37 $lifetime = '86400';
39 @header('Content-type: text/javascript');
40 @header('Content-length: '.strlen($output));
41 @header('Last-Modified: '. gmdate('D, d M Y H:i:s', time()) .' GMT');
42 @header('Cache-control: max-age='.$lifetime);
43 @header('Expires: '. gmdate('D, d M Y H:i:s', time() + $lifetime) .'GMT');
44 @header('Pragma: ');
46 echo $output;