ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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"
 

Function Documentation

◆ convert()

convert (   $file)

Definition at line 137 of file HFile_conv.php.

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

Referenced by dump_hash(), and showHelp().

137  {
138  $file = str_replace("./", "", $file);
139  global $LANGNAME;
140  $LANGNAME = $file;
141  $LANGNAME = str_replace(".txt", "", $LANGNAME);
142 
143  $fileout = '../object/'.$LANGNAME . '.php';
144 
145  print "Writing $file to $fileout\n";
146 
147  HFile_parse_file($file);
148 
149  ob_start();
150  ob_implicit_flush(0);
151 
152  HFile_print_php_file(isset($fileout));
153  $out = ob_get_contents();
154  ob_end_clean();
155 
156  if (isset($fileout))
157  {
158  $fd = fopen($fileout, "w");
159  fputs($fd, $out);
160  fclose($fd);
161  }
162 
163 
164 
165 
166 
167 
168 
169 }
HFile_print_php_file($tofile=1)
Definition: HFile_conv.php:14
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 112 of file HFile_conv.php.

Referenced by dump_colours(), and HFile_print_php_file().

113 {
114  $first = 1;
115  print $name." = array(";
116  foreach($array as $a)
117  {
118  if (!$first) print ", "; else $first = 0;
119  print "\"".addslashes($a)."\"";
120  }
121  print ");\n";
122 }
+ Here is the caller graph for this function:

◆ dump_colours()

dump_colours (   $cats)

Definition at line 95 of file HFile_conv.php.

References array, and dump_array().

Referenced by HFile_print_php_file().

96 {
97  global $colours;
98 
99  $usedcols = array();
100  foreach($cats as $c)
101  {
102  array_push($usedcols, $colours[$c-1]);
103  }
104  dump_array($usedcols, "\$this->colours ");
105 }
Create styles array
The data for the language used.
dump_array($array, $name)
Definition: HFile_conv.php:112
+ 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 124 of file HFile_conv.php.

Referenced by dump_linkscripts(), and HFile_print_php_file().

125 {
126  $first = 1;
127  print $name." = array(";
128  foreach(array_keys($hash) as $k)
129  {
130  if (!$first) print ", "; else $first = 0;
131  print "\n \"".addslashes($k)."\"";
132  print " => \"".addslashes($hash[$k])."\"";
133  }
134  print ");\n";
135 }
+ Here is the caller graph for this function:

◆ dump_linkscripts()

dump_linkscripts (   $cats)

Definition at line 75 of file HFile_conv.php.

References array, and dump_hash().

Referenced by HFile_print_php_file().

76 {
77  print "
78 // Each category can specify a PHP function that returns an altered
79 // version of the keyword.
80  # This link is then placed in a <a href=\"...\">foo</a>; structure around keyword 'foo' - which is
81  \n\n";
82 
83  $linkhash = array();
84 
85  foreach($cats as $c)
86  {
87  $linkhash{$c} = "donothing";
88  }
89 
90  dump_hash($linkhash, "\$this->linkscripts ");
91  print "}\n# DoNothing link function\n\n";
92  print "function donothing(\$keywordin)\n{\n return \$keywordin;\n}\n";
93 }
dump_hash($hash, $name)
Definition: HFile_conv.php:124
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 107 of file HFile_conv.php.

Referenced by HFile_print_php_file().

108 {
109  print $name." = \"".addslashes($variable)."\";\n";
110 }
+ Here is the caller graph for this function:

◆ get_categories()

get_categories ( )

Definition at line 62 of file HFile_conv.php.

References array.

Referenced by HFile_print_php_file().

63 {
64  global $keywords;
65  $usedcats = array();
66 
67  foreach(array_keys($keywords) as $k)
68  {
69  $cat = $keywords[$k];
70  if (!in_array($cat, $usedcats)) array_push($usedcats, $cat);
71  }
72  return $usedcats;
73 }
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 14 of file HFile_conv.php.

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

Referenced by convert().

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