File: javascript-mod.php

package info (click to toggle)
moodle 1.6.3-2%2Betch3
  • links: PTS
  • area: main
  • in suites: etch
  • size: 37,172 kB
  • ctags: 51,688
  • sloc: php: 231,916; sql: 5,631; xml: 2,688; sh: 1,185; perl: 638; makefile: 48; pascal: 36
file content (48 lines) | stat: -rw-r--r-- 1,569 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
<?php  /// $Id: javascript-mod.php,v 1.1 2005/04/16 12:10:44 moodler Exp $

       /// Searches modules, filters and blocks for any Javascript files
       /// that should be called on every page

    $nomoodlecookie = true;

    include('../config.php');

    $output = "// Javascript from Moodle modules\n";

    if ($mods = get_list_of_plugins('mod')) {
        foreach ($mods as $mod) {
            if (is_readable($CFG->dirroot.'/mod/'.$mod.'/javascript.php')) {
                $output .= file_get_contents($CFG->dirroot.'/mod/'.$mod.'/javascript.php');
            }
        }
    }

    if ($filters = get_list_of_plugins('filter')) {
        foreach ($filters as $filter) {
            if (is_readable($CFG->dirroot.'/filter/'.$filter.'/javascript.php')) {
                $output .= file_get_contents($CFG->dirroot.'/filter/'.$filter.'/javascript.php');
            }
        }
    }

    if ($blocks = get_list_of_plugins('blocks')) {
        foreach ($blocks as $block) {
            if (is_readable($CFG->dirroot.'/blocks/'.$block.'/javascript.php')) {
                $output .= file_get_contents($CFG->dirroot.'/blocks/'.$block.'/javascript.php');
            }
        }
    }


    $lifetime = '86400';

    @header('Content-type: text/javascript'); 
    @header('Content-length: '.strlen($output)); 
    @header('Last-Modified: '. gmdate('D, d M Y H:i:s', time()) .' GMT');
    @header('Cache-control: max-age='.$lifetime);
    @header('Expires: '. gmdate('D, d M Y H:i:s', time() + $lifetime) .'GMT');
    @header('Pragma: ');

    echo $output;

?>