ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
HFile_ueconv.php File Reference

Go to the source code of this file.

Functions

 HFile_print_php_file ($tofile=1)
 
 get_categories ()
 
 dump_linkscripts ($cats)
 
 dump_colours ($cats)
 
 dump_var ($variable, $name)
 
 dump_array ($array, $name)
 
 dump_hash ($hash, $name)
 

Variables

 $BEAUT_PATH = realpath(".")."/Services/COPage/syntax_highlight/php"
 
print $file
 

Function Documentation

◆ dump_array()

dump_array (   $array,
  $name 
)

Definition at line 98 of file HFile_ueconv.php.

99{
100 $first = 1;
101 print $name." = array(";
102 foreach($array as $a)
103 {
104 if (!$first) print ", "; else $first = 0;
105 print "\"".addslashes($a)."\"";
106 }
107 print ");\n";
108}
if(! $in) print

References print.

Referenced by dump_colours(), and HFile_print_php_file().

+ Here is the caller graph for this function:

◆ dump_colours()

dump_colours (   $cats)

Definition at line 81 of file HFile_ueconv.php.

82{
83 global $colours;
84
85 $usedcols = array();
86 foreach($cats as $c)
87 {
88 array_push($usedcols, $colours[$c-1]);
89 }
90 dump_array($usedcols, "\$colours ");
91}
dump_array($array, $name)

References dump_array().

Referenced by HFile_print_php_file().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ dump_hash()

dump_hash (   $hash,
  $name 
)

Definition at line 110 of file HFile_ueconv.php.

111{
112 $first = 1;
113 print $name." = array(";
114 foreach(array_keys($hash) as $k)
115 {
116 if (!$first) print ", "; else $first = 0;
117 print "\n \"".addslashes($k)."\"";
118 print " => \"".addslashes($hash[$k])."\"";
119 }
120 print ");\n";
121}
122
123?>
124<html><title>Configuration Converter</title><body>
125<h1>Important Note</h1>
126<p>This script should <b>not</b> be run on a public server. It is possible to access files other than syntax highlight files (by entering /etc/passwd, for example). Although this should not display anything useful, it is still possible that important data may be extractable. As such, only run this script <b>locally</b> (it should not be necessary to run it on a public server, anyway).</p>
127<form action="HFileconv.php">Please specify a syntax file to convert:<br />
128<input type="text" width="64" size="64" name="file" value="<?php print $file; ?>" /><br />
129Save to:<br />
130<input type="text" width="64" size="64" name="fileout" value="<?php print stripslashes($fileout); ?>" /><br />
131<input type="submit" /></form><hr />
132<pre>
133<?php
134if (isset($fileout) && $fileout == "") unset($fileout);
135if (isset($file) && file_exists($file))
136{
137 HFile_parse_file($file);
138 ob_start();
139 HFile_print_php_file(isset($fileout));
140 $out = ob_get_contents();
141 if (isset($fileout))
142 {
143 $fd = fopen($fileout, "w");
144 fputs($fd, $out);
145 fclose($fd);
146 }
147 ob_end_flush();
148}
convert($file)
Definition: HFile_conv.php:137
HFile_print_php_file($tofile=1)
print $file
An exception for terminatinating execution or to throw for unit testing.
input
Definition: langcheck.php:166
font size
Definition: langcheck.php:162
p
Definition: langcheck.php:169

References print.

Referenced by dump_linkscripts(), and HFile_print_php_file().

+ Here is the caller graph for this function:

◆ dump_linkscripts()

dump_linkscripts (   $cats)

Definition at line 61 of file HFile_ueconv.php.

62{
63 print "
64// Each category can specify a PHP function that returns an altered
65// version of the keyword.
66 # This link is then placed in a <a href=\"...\">foo</a>; structure around keyword 'foo' - which is
67 \n\n";
68
69 $linkhash = array();
70
71 foreach($cats as $c)
72 {
73 $linkhash{$c} = "donothing";
74 }
75
76 dump_hash($linkhash, "\$linkscripts ");
77 print "\n# DoNothing link function\n\n";
78 print "function donothing(\$keywordin)\n{\n return \$keywordin;\n}\n";
79}
dump_hash($hash, $name)

References dump_hash(), and print.

Referenced by HFile_print_php_file().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ dump_var()

dump_var (   $variable,
  $name 
)

Definition at line 93 of file HFile_ueconv.php.

94{
95 print $name." = \"".addslashes($variable)."\";\n";
96}

References print.

Referenced by HFile_print_php_file().

+ Here is the caller graph for this function:

◆ get_categories()

get_categories ( )

Definition at line 48 of file HFile_ueconv.php.

49{
50 global $keywords;
51 $usedcats = array();
52
53 foreach(array_keys($keywords) as $k)
54 {
55 $cat = $keywords[$k];
56 if (!in_array($cat, $usedcats)) array_push($usedcats, $cat);
57 }
58 return $usedcats;
59}

Referenced by HFile_print_php_file().

+ Here is the caller graph for this function:

◆ HFile_print_php_file()

HFile_print_php_file (   $tofile = 1)

Definition at line 10 of file HFile_ueconv.php.

11{
12 global $indent, $unindent, $stringchars, $config, $keywords, $delimiters, $lang_name;
13 global $linecommenton, $blockcommenton, $blockcommentoff;
14 global $perl, $nocase, $notrim;
15 if ($tofile) print "<?php\n"; else print "&lt;?\n";
16 print "######################################\n";
17 print "# Beautifier Highlighting Configuration File \n";
18 print "# $lang_name\n";
19 print "######################################\n";
20 print "# Flags\n\n";
21 dump_var($nocase, "\$nocase ");
22 dump_var($notrim, "\$notrim ");
23 dump_var($perl, "\$perl ");
24 print "\n# Colours\n\n";
25 $used_categories = get_categories();
26 dump_colours($used_categories);
27 dump_var("blue", "\$quotecolour ");
28 dump_var("green", "\$blockcommentcolour");
29 dump_var("green", "\$linecommentcolour ");
30 print "\n# Indent Strings\n\n";
31 dump_array($indent, "\$indent ");
32 dump_array($unindent, "\$unindent ");
33 print "\n# String characters and delimiters\n\n";
34 dump_array($stringchars, "\$stringchars ");
35 dump_array($delimiters, "\$delimiters ");
36 dump_var ($escchar, "\$escchar ");
37 print "\n# Comment settings\n\n";
38 dump_var ($linecommenton, "\$linecommenton ");
39 dump_var ($blockcommenton, "\$blockcommenton ");
40 dump_var ($blockcommentoff, "\$blockcommentoff ");
41 print "\n# Keywords (keyword mapping to colour number)\n\n";
42 dump_hash ($keywords, "\$keywords ");
43 print "\n# Special extensions\n";
44 dump_linkscripts($used_categories);
45 if ($tofile) print "\n?>"; else print "\n?&gt;";
46}
dump_var($variable, $name)
dump_linkscripts($cats)
get_categories()
dump_colours($cats)

References $config, dump_array(), dump_colours(), dump_hash(), dump_linkscripts(), dump_var(), get_categories(), and print.

+ Here is the call graph for this function:

Variable Documentation

◆ $BEAUT_PATH

$BEAUT_PATH = realpath(".")."/Services/COPage/syntax_highlight/php"

Definition at line 2 of file HFile_ueconv.php.

◆ $file

print $file

Definition at line 128 of file HFile_ueconv.php.