ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
HFile_conv.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)
 
 convert ($file)
 

Variables

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

Function Documentation

◆ convert()

convert (   $file)

Definition at line 151 of file HFile_conv.php.

References $argv, $file, $out, and HFile_print_php_file().

Referenced by dump_hash(), and showHelp().

152 {
153  $file = str_replace("./", "", $file);
154  global $LANGNAME;
155  $LANGNAME = $file;
156  $LANGNAME = str_replace(".txt", "", $LANGNAME);
157 
158  $fileout = '../object/' . $LANGNAME . '.php';
159 
160  print "Writing $file to $fileout\n";
161 
162  HFile_parse_file($file);
163 
164  ob_start();
165  ob_implicit_flush(0);
166 
167  HFile_print_php_file(isset($fileout));
168  $out = ob_get_contents();
169  ob_end_clean();
170 
171  if (isset($fileout)) {
172  $fd = fopen($fileout, "w");
173  fputs($fd, $out);
174  fclose($fd);
175  }
176 }
HFile_print_php_file($tofile=1)
Definition: HFile_conv.php:16
if(!file_exists("$old.txt")) if($old===$new) if(file_exists("$new.txt")) $file
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ dump_array()

dump_array (   $array,
  $name 
)

Definition at line 120 of file HFile_conv.php.

References $name.

Referenced by dump_colours(), and HFile_print_php_file().

121 {
122  $first = 1;
123  print $name . " = array(";
124  foreach ($array as $a) {
125  if (!$first) {
126  print ", ";
127  } else {
128  $first = 0;
129  }
130  print "\"" . addslashes($a) . "\"";
131  }
132  print ");\n";
133 }
if($format !==null) $name
Definition: metadata.php:146
+ Here is the caller graph for this function:

◆ dump_colours()

dump_colours (   $cats)

Definition at line 104 of file HFile_conv.php.

References array, and dump_array().

Referenced by HFile_print_php_file().

105 {
106  global $colours;
107 
108  $usedcols = array();
109  foreach ($cats as $c) {
110  array_push($usedcols, $colours[$c-1]);
111  }
112  dump_array($usedcols, "\$this->colours ");
113 }
Create styles array
The data for the language used.
dump_array($array, $name)
Definition: HFile_conv.php:120
+ 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 135 of file HFile_conv.php.

References $name.

Referenced by dump_linkscripts(), and HFile_print_php_file().

136 {
137  $first = 1;
138  print $name . " = array(";
139  foreach (array_keys($hash) as $k) {
140  if (!$first) {
141  print ", ";
142  } else {
143  $first = 0;
144  }
145  print "\n \"" . addslashes($k) . "\"";
146  print " => \"" . addslashes($hash[$k]) . "\"";
147  }
148  print ");\n";
149 }
if($format !==null) $name
Definition: metadata.php:146
+ Here is the caller graph for this function:

◆ dump_linkscripts()

dump_linkscripts (   $cats)

Definition at line 85 of file HFile_conv.php.

References array, and dump_hash().

Referenced by HFile_print_php_file().

86 {
87  print "
88 // Each category can specify a PHP function that returns an altered
89 // version of the keyword.
90  # This link is then placed in a <a href=\"...\">foo</a>; structure around keyword 'foo' - which is
91  \n\n";
92 
93  $linkhash = array();
94 
95  foreach ($cats as $c) {
96  $linkhash{$c} = "donothing";
97  }
98 
99  dump_hash($linkhash, "\$this->linkscripts ");
100  print "}\n# DoNothing link function\n\n";
101  print "function donothing(\$keywordin)\n{\n return \$keywordin;\n}\n";
102 }
dump_hash($hash, $name)
Definition: HFile_conv.php:135
Create styles array
The data for the language used.
+ 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 115 of file HFile_conv.php.

References $name.

Referenced by HFile_print_php_file().

116 {
117  print $name . " = \"" . addslashes($variable) . "\";\n";
118 }
if($format !==null) $name
Definition: metadata.php:146
+ Here is the caller graph for this function:

◆ get_categories()

get_categories ( )

Definition at line 71 of file HFile_conv.php.

References array.

Referenced by HFile_print_php_file().

72 {
73  global $keywords;
74  $usedcats = array();
75 
76  foreach (array_keys($keywords) as $k) {
77  $cat = $keywords[$k];
78  if (!in_array($cat, $usedcats)) {
79  array_push($usedcats, $cat);
80  }
81  }
82  return $usedcats;
83 }
Create styles array
The data for the language used.
+ Here is the caller graph for this function:

◆ HFile_print_php_file()

HFile_print_php_file (   $tofile = 1)

Definition at line 16 of file HFile_conv.php.

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

Referenced by convert().

17 {
18  global $LANGNAME;
19  global $indent, $unindent, $stringchars, $config, $keywords, $delimiters, $lang_name;
20  global $linecommenton, $blockcommenton, $blockcommentoff;
21  global $perl, $nocase, $notrim;
22  if ($tofile) {
23  print "<?php\n";
24  } else {
25  print "&lt;?\n";
26  }
27 
28  print 'require_once(\'HFile.php\');' . "\n";
29  print ' class HFile_' . $LANGNAME . ' extends HFile{' . "\n";
30  print ' function HFile_' . $LANGNAME . '(){' . "\n";
31  print ' $this->HFile(); ' . "\n";
32 
33 
34 
35  print "######################################\n";
36  print "# Beautifier Highlighting Configuration File \n";
37  print "# $lang_name\n";
38  print "######################################\n";
39  print "# Flags\n\n";
40  dump_var($nocase, "\$this->nocase ");
41  dump_var($notrim, "\$this->notrim ");
42  dump_var($perl, "\$this->perl ");
43  print "\n# Colours\n\n";
44  $used_categories = get_categories();
45  dump_colours($used_categories);
46  dump_var("blue", "\$this->quotecolour ");
47  dump_var("green", "\$this->blockcommentcolour");
48  dump_var("green", "\$this->linecommentcolour ");
49  print "\n# Indent Strings\n\n";
50  dump_array($indent, "\$this->indent ");
51  dump_array($unindent, "\$this->unindent ");
52  print "\n# String characters and delimiters\n\n";
53  dump_array($stringchars, "\$this->stringchars ");
54  dump_array($delimiters, "\$this->delimiters ");
55  dump_var($escchar, "\$this->escchar ");
56  print "\n# Comment settings\n\n";
57  dump_var($linecommenton, "\$this->linecommenton ");
58  dump_var($blockcommenton, "\$this->blockcommenton ");
59  dump_var($blockcommentoff, "\$this->blockcommentoff ");
60  print "\n# Keywords (keyword mapping to colour number)\n\n";
61  dump_hash($keywords, "\$this->keywords ");
62  print "\n# Special extensions\n";
63  dump_linkscripts($used_categories);
64  if ($tofile) {
65  print "\n}?>";
66  } else {
67  print "}\n?&gt;";
68  }
69 }
get_categories()
Definition: HFile_conv.php:71
dump_linkscripts($cats)
Definition: HFile_conv.php:85
dump_hash($hash, $name)
Definition: HFile_conv.php:135
dump_colours($cats)
Definition: HFile_conv.php:104
dump_array($array, $name)
Definition: HFile_conv.php:120
dump_var($variable, $name)
Definition: HFile_conv.php:115
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Variable Documentation

◆ $BEAUT_PATH

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

Definition at line 6 of file HFile_conv.php.

◆ if

if(!isset($BEAUT_PATH))

Definition at line 7 of file HFile_conv.php.