File: defaultsettings.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 (53 lines) | stat: -rw-r--r-- 2,403 bytes parent folder | download | duplicates (2)
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
49
50
51
52
53
<?php
    // defaultsettings.php
    // deafault settings are done here, saves doing all this twice in
    // both the rendering routine and the config screen

    function tex_defaultsettings( $force=false  ) {

        global $CFG;

        if (!isset($CFG->filter_tex_latexpreamble) or $force) {
            set_config( 'filter_tex_latexpreamble', " \\usepackage[latin1]{inputenc}\n \\usepackage{amsmath}\n \\usepackage{amsfonts}\n \\RequirePackage{amsmath,amssymb,latexsym}\n");
        }

        if (!isset($CFG->filter_tex_latexbackground) or $force) {
            set_config( 'filter_tex_latexbackground', '#FFFFFF' );
        }

        if (!isset($CFG->filter_tex_density) or $force) {
            set_config( 'filter_tex_density', '120' );
        }

        // defaults for paths - if one not set assume all not set
        if (!isset($CFG->filter_tex_pathlatex) or $force) {
            // load the paths for the appropriate OS
            // it would be nice to expand this
            if (PHP_OS=='Linux') {
                $binpath = '/usr/bin/';
                set_config( 'filter_tex_pathlatex',"{$binpath}latex" );
                set_config( 'filter_tex_pathdvips',"{$binpath}dvips" );
                set_config( 'filter_tex_pathconvert',"{$binpath}convert" );
            }
            elseif (PHP_OS=='Darwin') {
                $binpath = '/sw/bin/'; // most likely needs a fink install (fink.sf.net)
                set_config( 'filter_tex_pathlatex',"{$binpath}latex" );
                set_config( 'filter_tex_pathdvips',"{$binpath}dvips" );
                set_config( 'filter_tex_pathconvert',"{$binpath}convert" );
            }
            elseif (PHP_OS=='WINNT' or PHP_OS=='WIN32' or PHP_OS=='Windows') {
            // note: you need Ghostscript installed (standard), miktex (standard)
            // and ImageMagick (install at c:\ImageMagick)
            set_config( 'filter_tex_pathlatex',"\"c:\\texmf\\miktex\\bin\\latex.exe\" " );
                set_config( 'filter_tex_pathdvips',"\"c:\\texmf\\miktex\\bin\\dvips.exe\" " );
                set_config( 'filter_tex_pathconvert',"\"c:\\imagemagick\\convert.exe\" " );
            }    
            else {
                set_config( 'filter_tex_pathlatex','' );
                set_config( 'filter_tex_pathdvips','' );
                set_config( 'filter_tex_pathconvert','' );
            }
        }

    } 
?>