ILIAS  release_5-2 Revision v5.2.25-18-g3f80b82851
cssgen.php File Reference

Go to the source code of this file.

Functions

 make_header ( $title)
 
 make_footer ()
 
 get_var ( $var_name)
 

Variables

foreach( $_REQUEST as $var) foreach(array('_POST'=> 'HTTP_POST_VARS', '_GET'=> 'HTTP_GET_VARS', '_COOKIE'=> 'HTTP_COOKIE_VARS', '_SERVER'=> 'HTTP_SERVER_VARS', '_ENV'=> 'HTTP_ENV_VARS', '_FILES'=> 'HTTP_POST_FILES') as $array=> $other) $step = get_var('step')
 

Function Documentation

◆ get_var()

get_var (   $var_name)

Definition at line 116 of file cssgen.php.

References $_GET, $_POST, and array.

117 {
118  if ( isset($_GET[$var_name]) )
119  {
120  return str_replace("\'", "'", $_GET[$var_name]);
121  }
122  elseif ( isset($_POST[$var_name]) )
123  {
124  return str_replace("\'", "'", $_POST[$var_name]);
125  }
126  return null;
127 }
128 
129 
130 
131 //
132 // Unset everything
133 //
134 foreach ( $_REQUEST as $var )
135 {
136  unset($$var);
137 }
138 foreach ( array(
139  '_POST' => 'HTTP_POST_VARS',
140  '_GET' => 'HTTP_GET_VARS',
141  '_COOKIE' => 'HTTP_COOKIE_VARS',
142  '_SERVER' => 'HTTP_SERVER_VARS',
143  '_ENV' => 'HTTP_ENV_VARS',
144  '_FILES' => 'HTTP_POST_FILES') as $array => $other )
145 {
146  if ( !isset($$array) )
147  {
148  $$array = $$other;
149  }
150  unset($$other);
151 }
152 
153 
154 // Get what step we're up to
155 $step = get_var('step');
156 
157 if ( !$step || $step == 1 )
158 {
159  $errors = 0;
160  make_header('Step 1');
161  echo "Welcome to the GeSHi CSS generator.<br /><pre>Searching for GeSHi... ";
162 
163  // Find GeSHi
164  $geshi_path = get_var('geshi-path');
165  $geshi_lang_path = get_var('geshi-lang-path');
166 
167  if(strstr($geshi_path, '..')) {
168  unset($geshi_path);
169  }
170  if(strstr($geshi_lang_path, '..')) {
171  unset($geshi_lang_path);
172  }
173 
174  if ( !$geshi_path )
175  {
176  $geshi_path = '../geshi.php';
177  }
178  if ( !$geshi_lang_path )
179  {
180  $geshi_lang_path = '../geshi/';
181  }
182 
183  if ( is_file($geshi_path) && is_readable($geshi_path) )
184  {
185  // Get file contents and see if GeSHi is in here
186  $file = @file($geshi_path);
187  $contents = '';
188  foreach ( $file as $line )
189  {
190  $contents .= $line;
191  }
192  if ( strpos($contents, '<?php";
378 
379  if ( $overall != '' )
380  {
381  $stylesheet .= "\n$overall_selector {{$overall_styles}}";
382  }
383  if ( $default_styles != '' )
384  {
385  $default_selector = str_replace(array('{PART1}', '{PART2}'), array('.de1', '.de2'), $part_selector_2);
386  $stylesheet .= "\n$default_selector {{$default_styles}}";
387  }
388 
389  // Do keywords
390  $keywords_1 = get_var('keywords-1');
391  $keyword_selector_1 = str_replace('{PART}', '.kw1', $part_selector_1);
392  if ( $keywords_1 != '' )
393  {
394  $stylesheet .= "\n$keyword_selector_1 {{$keywords_1}}";
395  }
396 
397  $keywords_2 = get_var('keywords-2');
398  $keyword_selector_2 = str_replace('{PART}', '.kw2', $part_selector_1);
399  if ( $keywords_2 != '' )
400  {
401  $stylesheet .= "\n$keyword_selector_2 {{$keywords_2}}";
402  }
403 
404  $keywords_3 = get_var('keywords-3');
405  $keyword_selector_3 = str_replace('{PART}', '.kw3', $part_selector_1);
406  if ( $keywords_3 != '' )
407  {
408  $stylesheet .= "\n$keyword_selector_3 {{$keywords_3}}";
409  }
410 
411  $keywords_4 = get_var('keywords-4');
412  $keyword_selector_4 = str_replace('{PART}', '.kw4', $part_selector_1);
413  if ( $keywords_4 != '' )
414  {
415  $stylesheet .= "\n$keyword_selector_4 {{$keywords_4}}";
416  }
417 
418  // Do other lexics
419  $comments = get_var('comments');
420  $comment_selector = str_replace(array('{PART1}', '{PART2}', '{PART3}'), array('.co1', '.co2', '.coMULTI'), $part_selector_3);
421  if ( $comments != '' )
422  {
423  $stylesheet .= "\n$comment_selector {{$comments}}";
424  }
425 
426  $esc = get_var('escaped-chars');
427  $esc_selector = str_replace('{PART}', '.es0', $part_selector_1);
428  if ( $esc != '' )
429  {
430  $stylesheet .= "\n$esc_selector {{$esc}}";
431  }
432 
433  $brackets = get_var('brackets');
434  $brk_selector = str_replace('{PART}', '.br0', $part_selector_1);
435  if ( $brackets != '' )
436  {
437  $stylesheet .= "\n$brk_selector {{$brackets}}";
438  }
439 
440  $strings = get_var('strings');
441  $string_selector = str_replace('{PART}', '.st0', $part_selector_1);
442  if ( $strings != '' )
443  {
444  $stylesheet .= "\n$string_selector {{$strings}}";
445  }
446 
447  $numbers = get_var('numbers');
448  $num_selector = str_replace('{PART}', '.nu0', $part_selector_1);
449  if ( $numbers != '' )
450  {
451  $stylesheet .= "\n$num_selector {{$numbers}}";
452  }
453 
454  $methods = get_var('methods');
455  $method_selector = str_replace('{PART}', '.me0', $part_selector_1);
456  if ( $methods != '' )
457  {
458  $stylesheet .= "\n$method_selector {{$methods}}";
459  }
460 
461  echo "<pre>$stylesheet</pre>";
462 
463  make_footer();
464 }
$_GET["client_id"]
make_header( $title)
Definition: cssgen.php:38
get_var( $var_name)
Definition: cssgen.php:116
foreach( $_REQUEST as $var) foreach(array('_POST'=> 'HTTP_POST_VARS', '_GET'=> 'HTTP_GET_VARS', '_COOKIE'=> 'HTTP_COOKIE_VARS', '_SERVER'=> 'HTTP_SERVER_VARS', '_ENV'=> 'HTTP_ENV_VARS', '_FILES'=> 'HTTP_POST_FILES') as $array=> $other) $step
Definition: cssgen.php:155
Reload workbook from saved file
Create styles array
The data for the language used.
$errors
if(!file_exists("$old.txt")) if($old===$new) if(file_exists("$new.txt")) $file
Add comments
$_POST["username"]

◆ make_footer()

make_footer ( )

Definition at line 109 of file cssgen.php.

110 {
111  echo '<div id="footer"><a href="http://qbnz.com/highlighter/">GeSHi</a> &copy; Nigel McNie, 2004, released under the GPL</div></body>
112 </html>';
113 }

◆ make_header()

make_header (   $title)

Definition at line 38 of file cssgen.php.

References $title.

39 {
40  echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
41 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
42 <head>
43  <title>GeSHi CSS Generator :: ' . $title . ' </title>
44  <style type="text/css" media="screen">
45  <!--
46  html {
47  font-family: Verdana, Arial, sans-serif;
48  font-size: 80%;
49  background-color: #d0d0d0;
50  }
51  body {
52  margin: 10px;
53  padding: 5px;
54  border: 1px solid #f0f0f0;
55  background-color: #f6f6f6;
56  }
57  h1 {
58  border-bottom: 2px solid #e0e0e0;
59  font-weight: normal;
60  font-size: 150%;
61  color: #c0c0c0;
62  }
63  input, textarea {
64  border: 1px solid #d0d0d0;
65  }
66  th {
67  text-align: right;
68  font-weight: normal;
69  }
70  pre {
71  font-size: 110%;
72  color: #202020;
73  }
74  #footer {
75  color: #b0b0b0;
76  text-align: center;
77  font-size: 90%;
78  margin: 0 auto;
79  border-top: 1px solid #e0e0e0;
80  }
81  #footer a {
82  color: #c0c0c0;
83  }
84  -->
85  </style>
86  <script type="text/javascript">
87  function select (state)
88  {
89  var cboxes = document.getElementsByTagName(\'input\');
90  for (var i = 0; i < cboxes.length; i++) {
91  if (cboxes[i].type == "checkbox") {
92  if (state == "true") {
93  cboxes[i].checked = true;
94  } elseif (state == "false") {
95  cboxes[i].checked = false;
96  } elseif (state == "invert") {
97  cboxes[i].checked = !cboxes[i].checked;
98  }
99  }
100  }
101  }
102  </script>
103 </head>
104 <body>
105 <h1>' . $title . '</h1>
106 ';
107 }

Variable Documentation

◆ $step

foreach ($_REQUEST as $var) foreach (array( '_POST'=> 'HTTP_POST_VARS', '_GET'=> 'HTTP_GET_VARS', '_COOKIE'=> 'HTTP_COOKIE_VARS', '_SERVER'=> 'HTTP_SERVER_VARS', '_ENV'=> 'HTTP_ENV_VARS', '_FILES'=> 'HTTP_POST_FILES') as $array=> $other) $step = get_var('step')