r94764 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r94763‎ | r94764 | r94765 >
Date:14:29, 17 August 2011
Author:maxsem
Status:ok
Tags:
Comment:
WikiHiero: ran stylize.php
Modified paths:
  • /trunk/extensions/wikihiero/index.php (modified) (history)
  • /trunk/extensions/wikihiero/wh_generate.php (modified) (history)
  • /trunk/extensions/wikihiero/wh_main.php (modified) (history)
  • /trunk/extensions/wikihiero/wh_table.php (modified) (history)
  • /trunk/extensions/wikihiero/wikihiero.php (modified) (history)

Diff [purge]

Index: trunk/extensions/wikihiero/wikihiero.php
@@ -33,7 +33,7 @@
3434 'url' => 'http://www.mediawiki.org/wiki/Extension:WikiHiero',
3535 'descriptionmsg' => 'wikihiero-desc',
3636 );
37 -$wgExtensionMessagesFiles['Wikihiero'] = dirname(__FILE__) . '/wikihiero.i18n.php';
 37+$wgExtensionMessagesFiles['Wikihiero'] = dirname( __FILE__ ) . '/wikihiero.i18n.php';
3838
3939 $wgAutoloadClasses['WikiHiero'] = dirname( __FILE__ ) . '/wh_main.php';
4040
Index: trunk/extensions/wikihiero/wh_main.php
@@ -28,45 +28,45 @@
2929 die( 'Not an entry point' );
3030 }
3131
32 -//========================================================================
 32+// ========================================================================
3333 // I N C L U D E S
34 -include( dirname(__FILE__) . '/wh_list.php' );
 34+include( dirname( __FILE__ ) . '/wh_list.php' );
3535
36 -//========================================================================
 36+// ========================================================================
3737 // D E F I N E S
38 -define("WH_TABLE_S", "<table border='0' cellspacing='0' cellpadding='0'>");
39 -define("WH_TABLE_E", "</table>");
40 -define("WH_TD_S", "<td align='center' valign='middle'>");
41 -define("WH_TD_E", "</td>");
 38+define( "WH_TABLE_S", "<table border='0' cellspacing='0' cellpadding='0'>" );
 39+define( "WH_TABLE_E", "</table>" );
 40+define( "WH_TD_S", "<td align='center' valign='middle'>" );
 41+define( "WH_TD_E", "</td>" );
4242
43 -define("WH_MODE_DEFAULT", -1); // use default mode
44 -define("WH_MODE_TEXT", 0); // text only
45 -define("WH_MODE_HTML", 1); // HTML without CSS
46 -define("WH_MODE_STYLE", 2); // HTML and CSS // not supported
47 -define("WH_MODE_IMAGE", 3); // picture (PNG) // not supported
48 -define("WH_MODE_RAW", 4); // MdC test as it
 43+define( "WH_MODE_DEFAULT", -1 ); // use default mode
 44+define( "WH_MODE_TEXT", 0 ); // text only
 45+define( "WH_MODE_HTML", 1 ); // HTML without CSS
 46+define( "WH_MODE_STYLE", 2 ); // HTML and CSS // not supported
 47+define( "WH_MODE_IMAGE", 3 ); // picture (PNG) // not supported
 48+define( "WH_MODE_RAW", 4 ); // MdC test as it
4949
50 -define("WH_TYPE_NONE", 0);
51 -define("WH_TYPE_GLYPH", 1); // rendered items
52 -define("WH_TYPE_CODE", 2); // single code as ':', '*', '!', '(' or ')'
53 -define("WH_TYPE_SPECIAL", 3); // advanced code (more than 1 caracter)
54 -define("WH_TYPE_END", 4); // end of line '!'
 50+define( "WH_TYPE_NONE", 0 );
 51+define( "WH_TYPE_GLYPH", 1 ); // rendered items
 52+define( "WH_TYPE_CODE", 2 ); // single code as ':', '*', '!', '(' or ')'
 53+define( "WH_TYPE_SPECIAL", 3 ); // advanced code (more than 1 caracter)
 54+define( "WH_TYPE_END", 4 ); // end of line '!'
5555
56 -define("WH_SCALE_DEFAULT", -1); // use default scale
57 -define("WH_HEIGHT", 44);
58 -define("WH_IMG_MARGIN", 1); // default value
59 -define("WH_CARTOUCHE_WIDTH", 2); // default value
 56+define( "WH_SCALE_DEFAULT", -1 ); // use default scale
 57+define( "WH_HEIGHT", 44 );
 58+define( "WH_IMG_MARGIN", 1 ); // default value
 59+define( "WH_CARTOUCHE_WIDTH", 2 ); // default value
6060
61 -define("WH_VER_MAJ", 0);
62 -define("WH_VER_MED", 2);
63 -define("WH_VER_MIN", 14);
 61+define( "WH_VER_MAJ", 0 );
 62+define( "WH_VER_MED", 2 );
 63+define( "WH_VER_MIN", 14 );
6464
6565 global $wgExtensionAssetsPath;
66 -define("WH_IMG_DIR", $wgExtensionAssetsPath . '/wikihiero/img/' );
67 -define("WH_IMG_PRE", "hiero_");
68 -define("WH_IMG_EXT", "png");
 66+define( "WH_IMG_DIR", $wgExtensionAssetsPath . '/wikihiero/img/' );
 67+define( "WH_IMG_PRE", "hiero_" );
 68+define( "WH_IMG_EXT", "png" );
6969
70 -define("WH_DEBUG_MODE", false);
 70+define( "WH_DEBUG_MODE", false );
7171
7272 class WikiHiero {
7373 private $scale = 100;
@@ -83,20 +83,20 @@
8484 * @param $line string: use line [true|false] (def=false)
8585 * @return string: converted code
8686 */
87 - public static function render( $text, $mode=WH_MODE_DEFAULT, $scale=WH_SCALE_DEFAULT, $line=false ) {
 87+ public static function render( $text, $mode = WH_MODE_DEFAULT, $scale = WH_SCALE_DEFAULT, $line = false ) {
8888 if ( $mode == WH_MODE_DEFAULT ) {
8989 $mode = WH_MODE_HTML;
9090 }
9191
9292 $hiero = new WikiHiero( $scale );
9393
94 - switch($mode) {
95 - case WH_MODE_TEXT: return $hiero->renderText( $text, $line);
96 - case WH_MODE_HTML: return $hiero->renderHtml( $text, $scale, $line);
97 - case WH_MODE_STYLE: die("ERROR: CSS version not yet implemented");
98 - case WH_MODE_IMAGE: die("ERROR: Image version not yet implemented");
 94+ switch( $mode ) {
 95+ case WH_MODE_TEXT: return $hiero->renderText( $text, $line );
 96+ case WH_MODE_HTML: return $hiero->renderHtml( $text, $scale, $line );
 97+ case WH_MODE_STYLE: die( "ERROR: CSS version not yet implemented" );
 98+ case WH_MODE_IMAGE: die( "ERROR: Image version not yet implemented" );
9999 }
100 - die("ERROR: Unknown mode!");
 100+ die( "ERROR: Unknown mode!" );
101101 }
102102
103103 /**
@@ -117,7 +117,7 @@
118118
119119 /**
120120 * Renders a glyph
121 - *
 121+ *
122122 * @param $glyph string: glyph's code to render
123123 * @param $option string: option to add into <img> tag (use for height)
124124 * @return string: a string to add to the stream
@@ -126,40 +126,40 @@
127127 global $wh_phonemes;
128128 global $wh_files;
129129
130 - if($glyph == "..") { // Render void block
 130+ if ( $glyph == ".." ) { // Render void block
131131 $width = WH_HEIGHT;
132132 return "<table width='{$width}px' border='0' cellspacing='0' cellpadding='0'><tr><td>&#160;</td></tr></table>";
133133 }
134 - elseif($glyph == ".") // Render half-width void block
 134+ elseif ( $glyph == "." ) // Render half-width void block
135135 {
136 - $width = WH_HEIGHT/2;
 136+ $width = WH_HEIGHT / 2;
137137 return "<table width='{$width}px' border='0' cellspacing='0' cellpadding='0'><tr><td>&#160;</td></tr></table>";
138138 }
139 - elseif($glyph == '<') // Render open cartouche
 139+ elseif ( $glyph == '<' ) // Render open cartouche
140140 {
141 - $height = intval(WH_HEIGHT * $this->scale / 100);
 141+ $height = intval( WH_HEIGHT * $this->scale / 100 );
142142 $code = $wh_phonemes[$glyph];
143 - return "<img src='".htmlspecialchars(WH_IMG_DIR.WH_IMG_PRE."{$code}.".WH_IMG_EXT)."' height='{$height}px' title='".htmlspecialchars($glyph)."' alt='".htmlspecialchars($glyph)."' />";
 143+ return "<img src='" . htmlspecialchars( WH_IMG_DIR . WH_IMG_PRE . "{$code}." . WH_IMG_EXT ) . "' height='{$height}px' title='" . htmlspecialchars( $glyph ) . "' alt='" . htmlspecialchars( $glyph ) . "' />";
144144 }
145 - elseif($glyph == '>') // Render close cartouche
 145+ elseif ( $glyph == '>' ) // Render close cartouche
146146 {
147 - $height = intval(WH_HEIGHT * $this->scale / 100);
 147+ $height = intval( WH_HEIGHT * $this->scale / 100 );
148148 $code = $wh_phonemes[$glyph];
149 - return "<img src='".htmlspecialchars(WH_IMG_DIR.WH_IMG_PRE."{$code}.".WH_IMG_EXT)."' height='{$height}px' title='".htmlspecialchars($glyph)."' alt='".htmlspecialchars($glyph)."' />";
 149+ return "<img src='" . htmlspecialchars( WH_IMG_DIR . WH_IMG_PRE . "{$code}." . WH_IMG_EXT ) . "' height='{$height}px' title='" . htmlspecialchars( $glyph ) . "' alt='" . htmlspecialchars( $glyph ) . "' />";
150150 }
151151
152 - if(array_key_exists($glyph, $wh_phonemes))
 152+ if ( array_key_exists( $glyph, $wh_phonemes ) )
153153 {
154154 $code = $wh_phonemes[$glyph];
155 - if(array_key_exists($code, $wh_files))
156 - return "<img style='margin:".WH_IMG_MARGIN."px;' $option src='".htmlspecialchars(WH_IMG_DIR.WH_IMG_PRE."{$code}.".WH_IMG_EXT)."' title='".htmlspecialchars("{$code} [{$glyph}]")."' alt='".htmlspecialchars($glyph)."' />";
 155+ if ( array_key_exists( $code, $wh_files ) )
 156+ return "<img style='margin:" . WH_IMG_MARGIN . "px;' $option src='" . htmlspecialchars( WH_IMG_DIR . WH_IMG_PRE . "{$code}." . WH_IMG_EXT ) . "' title='" . htmlspecialchars( "{$code} [{$glyph}]" ) . "' alt='" . htmlspecialchars( $glyph ) . "' />";
157157 else
158 - return "<font title='".htmlspecialchars($code)."'>".htmlspecialchars($glyph)."</font>";
 158+ return "<font title='" . htmlspecialchars( $code ) . "'>" . htmlspecialchars( $glyph ) . "</font>";
159159 }
160 - elseif(array_key_exists($glyph, $wh_files))
161 - return "<img style='margin:".WH_IMG_MARGIN."px;' $option src='".htmlspecialchars(WH_IMG_DIR.WH_IMG_PRE."{$glyph}.".WH_IMG_EXT)."' title='".htmlspecialchars($glyph)."' alt='".htmlspecialchars($glyph)."' />";
 160+ elseif ( array_key_exists( $glyph, $wh_files ) )
 161+ return "<img style='margin:" . WH_IMG_MARGIN . "px;' $option src='" . htmlspecialchars( WH_IMG_DIR . WH_IMG_PRE . "{$glyph}." . WH_IMG_EXT ) . "' title='" . htmlspecialchars( $glyph ) . "' alt='" . htmlspecialchars( $glyph ) . "' />";
162162 else
163 - return htmlspecialchars($glyph);
 163+ return htmlspecialchars( $glyph );
164164 }
165165
166166 /**
@@ -170,63 +170,63 @@
171171 * @param $total int: total size of a group for multi-glyph block
172172 * @return size
173173 */
174 - private function resizeGlyph( $item, $is_cartouche=false, $total=0 ) {
 174+ private function resizeGlyph( $item, $is_cartouche = false, $total = 0 ) {
175175 global $wh_phonemes;
176176 global $wh_files;
177177
178 - if(array_key_exists($item, $wh_phonemes)) {
 178+ if ( array_key_exists( $item, $wh_phonemes ) ) {
179179 $glyph = $wh_phonemes[$item];
180180 } else {
181181 $glyph = $item;
182182 }
183183
184184 $margin = 2 * WH_IMG_MARGIN;
185 - if($is_cartouche) {
186 - $margin += 2 * intval(WH_CARTOUCHE_WIDTH * $this->scale / 100);
 185+ if ( $is_cartouche ) {
 186+ $margin += 2 * intval( WH_CARTOUCHE_WIDTH * $this->scale / 100 );
187187 }
188188
189 - if(array_key_exists($glyph, $wh_files)) {
 189+ if ( array_key_exists( $glyph, $wh_files ) ) {
190190 $height = $margin + $wh_files[$glyph][1];
191 - if($total) {
192 - if($total > WH_HEIGHT) {
193 - return (intval( $height * WH_HEIGHT / $total ) - $margin) * $this->scale / 100;
 191+ if ( $total ) {
 192+ if ( $total > WH_HEIGHT ) {
 193+ return ( intval( $height * WH_HEIGHT / $total ) - $margin ) * $this->scale / 100;
194194 } else {
195 - return ($height - $margin) * $this->scale / 100;
 195+ return ( $height - $margin ) * $this->scale / 100;
196196 }
197197 } else {
198 - if($height > WH_HEIGHT) {
199 - return (intval( WH_HEIGHT * WH_HEIGHT / $height ) - $margin) * $this->scale / 100;
 198+ if ( $height > WH_HEIGHT ) {
 199+ return ( intval( WH_HEIGHT * WH_HEIGHT / $height ) - $margin ) * $this->scale / 100;
200200 } else {
201 - return ($height - $margin) * $this->scale / 100;
 201+ return ( $height - $margin ) * $this->scale / 100;
202202 }
203203 }
204204 }
205205
206 - return (WH_HEIGHT - $margin) * $this->scale / 100;
 206+ return ( WH_HEIGHT - $margin ) * $this->scale / 100;
207207 }
208208
209 - //------------------------------------------------------------------------
 209+ // ------------------------------------------------------------------------
210210 // WikiHieroText - Render hieroglyph text in text mode
211 - //------------------------------------------------------------------------
 211+ // ------------------------------------------------------------------------
212212 // hiero << text to convert
213213 // line << use line [true|false] (def=false)
214214 // return >> string with converted code
215 - //------------------------------------------------------------------------
216 - public function renderText($hiero, $line=false) {
 215+ // ------------------------------------------------------------------------
 216+ public function renderText( $hiero, $line = false ) {
217217 global $wh_text_conv;
218218
219219 $html = "";
220220
221 - if($line)
 221+ if ( $line )
222222 $html .= "<hr />\n";
223223
224 - for($char=0; $char<strlen($hiero); $char++)
 224+ for ( $char = 0; $char < strlen( $hiero ); $char++ )
225225 {
226 - if(array_key_exists($hiero[$char], $wh_text_conv))
 226+ if ( array_key_exists( $hiero[$char], $wh_text_conv ) )
227227 {
228228 $html .= $wh_text_conv[$hiero[$char]];
229 - if($hiero[$char] == '!')
230 - if($line)
 229+ if ( $hiero[$char] == '!' )
 230+ if ( $line )
231231 $html .= "<hr />\n";
232232 }
233233 else
@@ -236,29 +236,29 @@
237237 return $html;
238238 }
239239
240 - //------------------------------------------------------------------------
 240+ // ------------------------------------------------------------------------
241241 // WikiHiero - Render hieroglyph text
242 - //------------------------------------------------------------------------
 242+ // ------------------------------------------------------------------------
243243 // hiero << text to convert
244244 // scale << global scale in percentage (def=100%)
245245 // line << use line [true|false] (def=false)
246246 // return >> string with converted code
247 - //------------------------------------------------------------------------
248 - public function renderHtml($hiero, $scale = WH_SCALE_DEFAULT, $line=false) {
 247+ // ------------------------------------------------------------------------
 248+ public function renderHtml( $hiero, $scale = WH_SCALE_DEFAULT, $line = false ) {
249249 global $wh_prefabs;
250250 global $wh_files;
251251 global $wh_phonemes;
252252
253 - if($scale != WH_SCALE_DEFAULT)
 253+ if ( $scale != WH_SCALE_DEFAULT )
254254 $this->setScale( $scale );
255255
256256 $html = "";
257257
258 - if($line) {
 258+ if ( $line ) {
259259 $html .= "<hr />\n";
260260 }
261261
262 - //------------------------------------------------------------------------
 262+ // ------------------------------------------------------------------------
263263 // Split text into block, then split block into item
264264 $block = array();
265265 $block[0] = array();
@@ -269,17 +269,17 @@
270270 $type = WH_TYPE_NONE;
271271 $is_cartouche = false;
272272
273 - for($char=0; $char<strlen($hiero); $char++) {
 273+ for ( $char = 0; $char < strlen( $hiero ); $char++ ) {
274274
275 - if( $hiero[$char] == '(' ) {
 275+ if ( $hiero[$char] == '(' ) {
276276 $parenthesis++;
277 - } elseif( $hiero[$char] == ')' ) {
 277+ } elseif ( $hiero[$char] == ')' ) {
278278 $parenthesis--;
279279 }
280280
281 - if( $parenthesis == 0 ) {
282 - if($hiero[$char] == '-' || $hiero[$char] == ' ') {
283 - if($type != WH_TYPE_NONE) {
 281+ if ( $parenthesis == 0 ) {
 282+ if ( $hiero[$char] == '-' || $hiero[$char] == ' ' ) {
 283+ if ( $type != WH_TYPE_NONE ) {
284284 $block_id++;
285285 $block[$block_id] = array();
286286 $item_id = 0;
@@ -288,15 +288,15 @@
289289 }
290290 }
291291 } else {// don't slit block if inside parenthesis
292 - if($hiero[$char] == '-') {
 292+ if ( $hiero[$char] == '-' ) {
293293 $item_id++;
294294 $block[$block_id][$item_id] = '-';
295295 $type = WH_TYPE_CODE;
296296 }
297297 }
298298
299 - if($hiero[$char] == '!' ) {
300 - if($item_id > 0) {
 299+ if ( $hiero[$char] == '!' ) {
 300+ if ( $item_id > 0 ) {
301301 $block_id++;
302302 $block[$block_id] = array();
303303 $item_id = 0;
@@ -304,22 +304,22 @@
305305 $block[$block_id][$item_id] = $hiero[$char];
306306 $type = WH_TYPE_END;
307307
308 - } elseif(preg_match("/[*:()]/", $hiero[$char])) {
 308+ } elseif ( preg_match( "/[*:()]/", $hiero[$char] ) ) {
309309
310 - if($type == WH_TYPE_GLYPH || $type == WH_TYPE_CODE) {
 310+ if ( $type == WH_TYPE_GLYPH || $type == WH_TYPE_CODE ) {
311311 $item_id++;
312312 $block[$block_id][$item_id] = "";
313313 }
314314 $block[$block_id][$item_id] = $hiero[$char];
315315 $type = WH_TYPE_CODE;
316316
317 - } elseif(ctype_alnum($hiero[$char]) || $hiero[$char] == '.' || $hiero[$char] == '<' || $hiero[$char] == '>') {
318 - if($type == WH_TYPE_END) {
 317+ } elseif ( ctype_alnum( $hiero[$char] ) || $hiero[$char] == '.' || $hiero[$char] == '<' || $hiero[$char] == '>' ) {
 318+ if ( $type == WH_TYPE_END ) {
319319 $block_id++;
320320 $block[$block_id] = array();
321321 $item_id = 0;
322322 $block[$block_id][$item_id] = "";
323 - } elseif($type == WH_TYPE_CODE) {
 323+ } elseif ( $type == WH_TYPE_CODE ) {
324324 $item_id++;
325325 $block[$block_id][$item_id] = "";
326326 }
@@ -329,11 +329,11 @@
330330 }
331331
332332 // DEBUG: See the block split table
333 - if(WH_DEBUG_MODE) {
 333+ if ( WH_DEBUG_MODE ) {
334334
335 - foreach($block as $code) {
 335+ foreach ( $block as $code ) {
336336 echo "| ";
337 - foreach($code as $item) {
 337+ foreach ( $code as $item ) {
338338 echo "$item | ";
339339 }
340340 echo "<br />\n";
@@ -341,35 +341,35 @@
342342 }
343343
344344 $contentHtml = $tableHtml = $tableContentHtml = "";
345 - //$html .= WH_TABLE_S."<tr>\n";
 345+ // $html .= WH_TABLE_S."<tr>\n";
346346
347 - //------------------------------------------------------------------------
 347+ // ------------------------------------------------------------------------
348348 // Loop into all blocks
349 - foreach($block as $code) {
 349+ foreach ( $block as $code ) {
350350
351351 // simplest case, the block contain only 1 code -> render
352 - if(count($code) == 1)
 352+ if ( count( $code ) == 1 )
353353 {
354 - if($code[0] == "!") { // end of line
355 - $tableHtml = "</tr>".WH_TABLE_E.WH_TABLE_S."<tr>\n";
356 - if($line) {
 354+ if ( $code[0] == "!" ) { // end of line
 355+ $tableHtml = "</tr>" . WH_TABLE_E . WH_TABLE_S . "<tr>\n";
 356+ if ( $line ) {
357357 $contentHtml .= "<hr />\n";
358358 }
359359
360 - } elseif(strchr($code[0], '<')) { // start cartouche
361 - $contentHtml .= WH_TD_S . self::renderGlyph($code[0]).WH_TD_E;
 360+ } elseif ( strchr( $code[0], '<' ) ) { // start cartouche
 361+ $contentHtml .= WH_TD_S . self::renderGlyph( $code[0] ) . WH_TD_E;
362362 $is_cartouche = true;
363 - $contentHtml .= "<td>".WH_TABLE_S."<tr><td height='".intval(WH_CARTOUCHE_WIDTH * $this->scale / 100)."px' bgcolor='black'></td></tr><tr><td>".WH_TABLE_S."<tr>";
 363+ $contentHtml .= "<td>" . WH_TABLE_S . "<tr><td height='" . intval( WH_CARTOUCHE_WIDTH * $this->scale / 100 ) . "px' bgcolor='black'></td></tr><tr><td>" . WH_TABLE_S . "<tr>";
364364
365 - } elseif(strchr($code[0], '>')) { // end cartouche
366 - $contentHtml .= "</tr>".WH_TABLE_E."</td></tr><tr><td height='".intval(WH_CARTOUCHE_WIDTH * $this->scale / 100)."px' bgcolor='black'></td></tr>".WH_TABLE_E."</td>";
 365+ } elseif ( strchr( $code[0], '>' ) ) { // end cartouche
 366+ $contentHtml .= "</tr>" . WH_TABLE_E . "</td></tr><tr><td height='" . intval( WH_CARTOUCHE_WIDTH * $this->scale / 100 ) . "px' bgcolor='black'></td></tr>" . WH_TABLE_E . "</td>";
367367 $is_cartouche = false;
368 - $contentHtml .= WH_TD_S . self::renderGlyph($code[0]).WH_TD_E;
 368+ $contentHtml .= WH_TD_S . self::renderGlyph( $code[0] ) . WH_TD_E;
369369
370 - } elseif($code[0] != "") { // assum is glyph or '..' or '.'
371 - $option = "height='".$this->resizeGlyph($code[0], $is_cartouche)."px'";
 370+ } elseif ( $code[0] != "" ) { // assum is glyph or '..' or '.'
 371+ $option = "height='" . $this->resizeGlyph( $code[0], $is_cartouche ) . "px'";
372372
373 - $contentHtml .= WH_TD_S . self::renderGlyph($code[0], $option).WH_TD_E;
 373+ $contentHtml .= WH_TD_S . self::renderGlyph( $code[0], $option ) . WH_TD_E;
374374 }
375375
376376 // block contain more than 1 glyph
@@ -377,8 +377,8 @@
378378
379379 // convert all code into '&' to test prefabs glyph
380380 $temp = "";
381 - foreach($code as $t) {
382 - if(preg_match("/[*:!()]/", $t[0])) {
 381+ foreach ( $code as $t ) {
 382+ if ( preg_match( "/[*:!()]/", $t[0] ) ) {
383383 $temp .= "&";
384384 } else {
385385 $temp .= $t;
@@ -386,10 +386,10 @@
387387 }
388388
389389 // test is block is into tje prefabs list
390 - if(in_array($temp, $wh_prefabs)) {
391 - $option = "height='".$this->resizeGlyph($temp, $is_cartouche)."px'";
 390+ if ( in_array( $temp, $wh_prefabs ) ) {
 391+ $option = "height='" . $this->resizeGlyph( $temp, $is_cartouche ) . "px'";
392392
393 - $contentHtml .= WH_TD_S . self::renderGlyph($temp, $option).WH_TD_E;
 393+ $contentHtml .= WH_TD_S . self::renderGlyph( $temp, $option ) . WH_TD_E;
394394
395395 // block must be manualy computed
396396 } else {
@@ -398,31 +398,31 @@
399399 $total = 0;
400400 $height = 0;
401401
402 - foreach($code as $t) {
403 - if($t == ":") {
404 - if($height > $line_max) {
 402+ foreach ( $code as $t ) {
 403+ if ( $t == ":" ) {
 404+ if ( $height > $line_max ) {
405405 $line_max = $height;
406406 }
407407 $total += $line_max;
408408 $line_max = 0;
409409
410 - } elseif($t == "*") {
411 - if($height > $line_max) {
 410+ } elseif ( $t == "*" ) {
 411+ if ( $height > $line_max ) {
412412 $line_max = $height;
413413 }
414414 } else {
415 - if(array_key_exists($t, $wh_phonemes)) {
 415+ if ( array_key_exists( $t, $wh_phonemes ) ) {
416416 $glyph = $wh_phonemes[$t];
417417 } else {
418418 $glyph = $t;
419419 }
420 - if(array_key_exists($glyph, $wh_files)) {
 420+ if ( array_key_exists( $glyph, $wh_files ) ) {
421421 $height = 2 + $wh_files[$glyph][1];
422422 }
423423 }
424424 } // end foreach
425425
426 - if($height > $line_max) {
 426+ if ( $height > $line_max ) {
427427 $line_max = $height;
428428 }
429429
@@ -430,34 +430,34 @@
431431
432432 // render all glyph into the block
433433 $temp = "";
434 - foreach($code as $t) {
 434+ foreach ( $code as $t ) {
435435
436 - if($t == ":") {
 436+ if ( $t == ":" ) {
437437 $temp .= "<br />";
438438
439 - } elseif($t == "*") {
 439+ } elseif ( $t == "*" ) {
440440 $temp .= " ";
441441
442442 } else {
443443 // resize the glyph according to the block total height
444 - $option = "height='".$this->resizeGlyph($t, $is_cartouche, $total)."px'";
445 - $temp .= self::renderGlyph($t, $option);
 444+ $option = "height='" . $this->resizeGlyph( $t, $is_cartouche, $total ) . "px'";
 445+ $temp .= self::renderGlyph( $t, $option );
446446 }
447447 } // end foreach
448448
449 - $contentHtml .= WH_TD_S.$temp.WH_TD_E;
 449+ $contentHtml .= WH_TD_S . $temp . WH_TD_E;
450450 }
451451 $contentHtml .= "\n";
452452 }
453453
454 - if(strlen($contentHtml) > 0) {
455 - $tableContentHtml .= $tableHtml.$contentHtml;
 454+ if ( strlen( $contentHtml ) > 0 ) {
 455+ $tableContentHtml .= $tableHtml . $contentHtml;
456456 $contentHtml = $tableHtml = "";
457457 }
458458 }
459459
460 - if(strlen($tableContentHtml) > 0) {
461 - $html .= WH_TABLE_S."<tr>\n".$tableContentHtml."</tr>".WH_TABLE_E;
 460+ if ( strlen( $tableContentHtml ) > 0 ) {
 461+ $html .= WH_TABLE_S . "<tr>\n" . $tableContentHtml . "</tr>" . WH_TABLE_E;
462462 }
463463
464464 return "<table border='0' cellspacing='0' cellpadding='0' style='display:inline;' class='mw-hierotable' dir='ltr'><tr><td>\n$html\n</td></tr></table>";
@@ -465,7 +465,7 @@
466466
467467 }
468468
469 -//========================================================================
 469+// ========================================================================
470470 // G L O B A L S
471471 global $wh_phonemes, $wh_text_conv;
472472
@@ -866,13 +866,13 @@
867867 "y" => "Z4",
868868 "W" => "Z7",
869869
870 - "<1" => "Ca1", //cartouche
 870+ "<1" => "Ca1", // cartouche
871871 "2>" => "Ca2",
872872 "<2" => "Ca2a",
873873 "1>" => "Ca1a",
874874 "<0" => "Ca1",
875875 "0>" => "Ca2",
876 - "<h1" => "Cah1", //horus
 876+ "<h1" => "Cah1", // horus
877877 "h1>" => "Cah1a",
878878 "<h2" => "Cah2",
879879 "h2>" => "Cah2a",
@@ -880,7 +880,7 @@
881881 "h3>" => "Cah3a",
882882 "<h0" => "Cah1",
883883 "h0>" => "Cah1a",
884 - "<" => "Ca1", //cartouche
 884+ "<" => "Ca1", // cartouche
885885 ">" => "Ca2",
886886 "[&" => "Ba16",
887887 "&]" => "Ba16",
@@ -960,7 +960,7 @@
961961 "1>" => ")",
962962 "<0" => "(",
963963 "0>" => ")|",
964 - "<h1" => "[", //horus
 964+ "<h1" => "[", // horus
965965 "h1>" => "]",
966966 "<h2" => "[",
967967 "h2>" => "]",
@@ -968,37 +968,37 @@
969969 "h3>" => "]",
970970 "<h0" => "[",
971971 "h0>" => "]",
972 - "<" => "(", //cartouche
 972+ "<" => "(", // cartouche
973973 ">" => ")|",
974974 );
975975
976 -//========================================================================
 976+// ========================================================================
977977 // F U N C T I O N S
978978
979979
980 -//========================================================================
 980+// ========================================================================
981981 //
982982 // W i k i H i e r o
983983 //
984984
985 -//------------------------------------------------------------------------
 985+// ------------------------------------------------------------------------
986986 // WH_GetCode - Get glyph code from file name
987 -//------------------------------------------------------------------------
 987+// ------------------------------------------------------------------------
988988 // file << file name
989989 // return >> string with converted code
990 -//------------------------------------------------------------------------
991 -function WH_GetCode($file) {
992 - return substr($file, strlen(WH_IMG_PRE), -(1+strlen(WH_IMG_EXT)));
 990+// ------------------------------------------------------------------------
 991+function WH_GetCode( $file ) {
 992+ return substr( $file, strlen( WH_IMG_PRE ), -( 1 + strlen( WH_IMG_EXT ) ) );
993993 }
994994
995 -//------------------------------------------------------------------------
 995+// ------------------------------------------------------------------------
996996 // WH_Credit - Get glyph code from file name
997 -//------------------------------------------------------------------------
 997+// ------------------------------------------------------------------------
998998 // return >> credit string
999 -//------------------------------------------------------------------------
 999+// ------------------------------------------------------------------------
10001000 function WH_Credit() {
10011001 $html = "";
1002 - $html .= "<b>WikiHiero v".WH_VER_MAJ.".".WH_VER_MED.".".WH_VER_MIN."</b>\n";
 1002+ $html .= "<b>WikiHiero v" . WH_VER_MAJ . "." . WH_VER_MED . "." . WH_VER_MIN . "</b>\n";
10031003 $html .= "by Guillaume Blanchard (Aoineko) under GPL (2004).<br />\n";
10041004 $html .= "Hieroglyph credit: S. Rosmorduc, G. Watson, J. Hirst (under GFDL).\n";
10051005 return $html;
Index: trunk/extensions/wikihiero/wh_table.php
@@ -32,13 +32,13 @@
3333 #
3434
3535 # Fixme ! webRequest :)
36 -if(array_key_exists("table", $_GET)) {
 36+if ( array_key_exists( "table", $_GET ) ) {
3737 $table = $_GET["table"];
3838 } else {
3939 $table = "All";
4040 }
4141
42 -if(array_key_exists("lang", $_GET)) {
 42+if ( array_key_exists( "lang", $_GET ) ) {
4343 $lang = $_GET["lang"];
4444 } else {
4545 $lang = "fr";
@@ -49,8 +49,8 @@
5050 global $wh_language;
5151 global $lang;
5252
53 - if(isset($wh_language[$index])) {
54 - if(isset($wh_language[$index][$lang])) {
 53+ if ( isset( $wh_language[$index] ) ) {
 54+ if ( isset( $wh_language[$index][$lang] ) ) {
5555 return $wh_language[$index][$lang];
5656 } else {
5757 return $wh_language[$index]["en"];
@@ -61,9 +61,9 @@
6262 }
6363
6464 ?>
65 -<html lang=<?php echo htmlspecialchars($lang); ?>>
 65+<html lang=<?php echo htmlspecialchars( $lang ); ?>>
6666 <head>
67 - <title><?php echo htmlspecialchars($table)." - ".WH_Text($table); ?> - WikiHiero</title>
 67+ <title><?php echo htmlspecialchars( $table ) . " - " . WH_Text( $table ); ?> - WikiHiero</title>
6868 <meta http-equiv="Content-type" content="text/html; charset=UTF-8">
6969 <link rel="shortcut icon" href="https://www.mediawiki.org/favicon.ico">
7070 </head>
@@ -71,59 +71,59 @@
7272
7373 <?php
7474
75 - echo "<b>" . htmlspecialchars( $table ) . "</b> - ".WH_Text($table)."<br /><br />";
76 - $dh = opendir(WH_IMG_DIR);
77 - if( $dh ) {
78 - while(($file = readdir($dh)) !== false) {
79 - if($table == "All")
 75+ echo "<b>" . htmlspecialchars( $table ) . "</b> - " . WH_Text( $table ) . "<br /><br />";
 76+ $dh = opendir( WH_IMG_DIR );
 77+ if ( $dh ) {
 78+ while ( ( $file = readdir( $dh ) ) !== false ) {
 79+ if ( $table == "All" )
8080 {
81 - $code = WH_GetCode($file);
82 - if(in_array($code, $wh_phonemes))
83 - echo "<img src=\"".htmlspecialchars( WH_IMG_DIR.$file ) . "\" " .
84 - "title=\"" . htmlspecialchars( $code ) . " [".
85 - htmlspecialchars( array_search($code, $wh_phonemes) ) . "]\">\n";
 81+ $code = WH_GetCode( $file );
 82+ if ( in_array( $code, $wh_phonemes ) )
 83+ echo "<img src=\"" . htmlspecialchars( WH_IMG_DIR . $file ) . "\" " .
 84+ "title=\"" . htmlspecialchars( $code ) . " [" .
 85+ htmlspecialchars( array_search( $code, $wh_phonemes ) ) . "]\">\n";
8686 else
87 - echo "<img src=\"".htmlspecialchars( WH_IMG_DIR.$file ) . "\" title=\"" .
 87+ echo "<img src=\"" . htmlspecialchars( WH_IMG_DIR . $file ) . "\" title=\"" .
8888 htmlspecialchars( $code ) . "\">\n";
8989 }
90 - elseif($table == "Phoneme")
 90+ elseif ( $table == "Phoneme" )
9191 {
92 - $code = WH_GetCode($file);
93 - if(in_array($code, $wh_phonemes))
94 - echo "<img src=\"".htmlspecialchars( WH_IMG_DIR.$file ) . "\" " .
95 - "title=\"" . htmlspecialchars( $code ) . " [".
96 - htmlspecialchars( array_search($code, $wh_phonemes) )."]\">\n";
 92+ $code = WH_GetCode( $file );
 93+ if ( in_array( $code, $wh_phonemes ) )
 94+ echo "<img src=\"" . htmlspecialchars( WH_IMG_DIR . $file ) . "\" " .
 95+ "title=\"" . htmlspecialchars( $code ) . " [" .
 96+ htmlspecialchars( array_search( $code, $wh_phonemes ) ) . "]\">\n";
9797 }
98 - elseif($table == "Aa")
 98+ elseif ( $table == "Aa" )
9999 {
100 - $code = WH_GetCode($file);
101 - if((substr($code, 0, 2) == $table) && ctype_digit($code[2]))
 100+ $code = WH_GetCode( $file );
 101+ if ( ( substr( $code, 0, 2 ) == $table ) && ctype_digit( $code[2] ) )
102102 {
103 - if(in_array($code, $wh_phonemes))
104 - echo "<img src=\"".htmlspecialchars( WH_IMG_DIR.$file) . "\" title=\"" .
105 - htmlspecialchars( $code ) . " [".
106 - htmlspecialchars( array_search($code, $wh_phonemes) )."]\">\n";
 103+ if ( in_array( $code, $wh_phonemes ) )
 104+ echo "<img src=\"" . htmlspecialchars( WH_IMG_DIR . $file ) . "\" title=\"" .
 105+ htmlspecialchars( $code ) . " [" .
 106+ htmlspecialchars( array_search( $code, $wh_phonemes ) ) . "]\">\n";
107107 else
108 - echo "<img src=\"".htmlspecialchars( WH_IMG_DIR.$file ) . "\" title=\"" .
 108+ echo "<img src=\"" . htmlspecialchars( WH_IMG_DIR . $file ) . "\" title=\"" .
109109 htmlspecialchars( $code ) . "\">\n";
110110 }
111111 }
112112 else
113113 {
114 - $code = WH_GetCode($file);
115 - if(($code[0] == $table) && ctype_digit($code[1]))
 114+ $code = WH_GetCode( $file );
 115+ if ( ( $code[0] == $table ) && ctype_digit( $code[1] ) )
116116 {
117 - if(in_array($code, $wh_phonemes))
118 - echo "<img src=\"".htmlspecialchars( WH_IMG_DIR.$file ) . "\" title=\"" .
119 - htmlspecialchars( $code ) . "[".
120 - htmlspecialchars( array_search($code, $wh_phonemes) )."]\">\n";
 117+ if ( in_array( $code, $wh_phonemes ) )
 118+ echo "<img src=\"" . htmlspecialchars( WH_IMG_DIR . $file ) . "\" title=\"" .
 119+ htmlspecialchars( $code ) . "[" .
 120+ htmlspecialchars( array_search( $code, $wh_phonemes ) ) . "]\">\n";
121121 else
122 - echo "<img src=\"".htmlspecialchars( WH_IMG_DIR.$file ). "\" title=\"" .
 122+ echo "<img src=\"" . htmlspecialchars( WH_IMG_DIR . $file ) . "\" title=\"" .
123123 htmlspecialchars( $code ) . "\">\n";
124124 }
125125 }
126126 }
127 - closedir($dh);
 127+ closedir( $dh );
128128 }
129129
130130 ?>
Index: trunk/extensions/wikihiero/index.php
@@ -29,40 +29,40 @@
3030
3131 $IP = getenv( 'MW_INSTALL_PATH' );
3232 if ( $IP === false ) {
33 - $IP = dirname( __FILE__ ) .'/../..';
 33+ $IP = dirname( __FILE__ ) . '/../..';
3434 }
3535 require( "$IP/includes/WebStart.php" );
3636
37 -require('wh_language.php');
38 -require('wikihiero.php');
 37+require( 'wh_language.php' );
 38+require( 'wikihiero.php' );
3939 #
4040 # Initialization from request
4141 #
4242
4343 # FIXME : use webRequest
44 -if(isset($_POST["text"]))
 44+if ( isset( $_POST["text"] ) )
4545 $text = $_POST["text"];
4646 else
4747 $text = "anx-G5-zmA:tA:tA-nbty-zmA:tA:tA-sw:t-bit:t-<-zA-ra:.-mn:n-T:w-Htp:t*p->-anx-D:t:N17-!";
4848
49 -if(isset($_POST["scale"]))
 49+if ( isset( $_POST["scale"] ) )
5050 $scale = $_POST["scale"];
5151 else
5252 $scale = $wh_scale;
5353
54 -if(isset($_POST["mode"]))
 54+if ( isset( $_POST["mode"] ) )
5555 $mode = $_POST["mode"];
5656 else
5757 $mode = $wh_mode;
5858
59 -if(isset($_POST["lang"]))
 59+if ( isset( $_POST["lang"] ) )
6060 $lang = $_POST["lang"];
61 -elseif(isset($_GET["lang"]))
 61+elseif ( isset( $_GET["lang"] ) )
6262 $lang = $_GET["lang"];
6363 else
6464 $lang = "fr";
6565
66 -if(isset($_POST["line"]))
 66+if ( isset( $_POST["line"] ) )
6767 $line = $_POST["line"];
6868 else
6969 $line = false;
@@ -75,8 +75,8 @@
7676 global $wh_language;
7777 global $lang;
7878
79 - if(isset($wh_language[$index])) {
80 - if(isset($wh_language[$index][$lang]))
 79+ if ( isset( $wh_language[$index] ) ) {
 80+ if ( isset( $wh_language[$index][$lang] ) )
8181 return $wh_language[$index][$lang];
8282 else
8383 return $wh_language[$index]["en"];
@@ -85,15 +85,15 @@
8686 }
8787
8888 function WH_Packet( $ext ) {
89 - if(file_exists("wikihiero.$ext")) {
90 - $size = filesize("wikihiero.$ext");
91 - if($size <= 1024*1024) {
92 - return sprintf("<a href=\"wikihiero.$ext\" title=\"%.2f Kb\">%s</a>", filesize("wikihiero.$ext")/1024, strtoupper($ext));
 89+ if ( file_exists( "wikihiero.$ext" ) ) {
 90+ $size = filesize( "wikihiero.$ext" );
 91+ if ( $size <= 1024 * 1024 ) {
 92+ return sprintf( "<a href=\"wikihiero.$ext\" title=\"%.2f Kb\">%s</a>", filesize( "wikihiero.$ext" ) / 1024, strtoupper( $ext ) );
9393 } else {
94 - return sprintf("<a href=\"wikihiero.$ext\" title=\"%.2f Mb\">%s</a>", filesize("wikihiero.$ext")/(1024*1024), strtoupper($ext));
 94+ return sprintf( "<a href=\"wikihiero.$ext\" title=\"%.2f Mb\">%s</a>", filesize( "wikihiero.$ext" ) / ( 1024 * 1024 ), strtoupper( $ext ) );
9595 }
9696 } else {
97 - return "<font title=\"File <wikihiero.$ext> not found!\">".strtoupper($ext)."</font>";
 97+ return "<font title=\"File <wikihiero.$ext> not found!\">" . strtoupper( $ext ) . "</font>";
9898 }
9999 }
100100
@@ -101,7 +101,7 @@
102102 global $lang;
103103 $url = "wh_table.php?table=" . urlencode( $table ) . '&lang=' . urlencode( $lang );
104104 $encUrl = htmlspecialchars( Xml::encodeJsVar( $url ) );
105 - echo "<a href=\"#\" onClick=\"MyWindow=window.open($encUrl,'$table','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=400,height=300,left=20,top=20'); return false;\" title =\"".WH_Text($table)."\">$table</a>";
 105+ echo "<a href=\"#\" onClick=\"MyWindow=window.open($encUrl,'$table','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=400,height=300,left=20,top=20'); return false;\" title =\"" . WH_Text( $table ) . "\">$table</a>";
106106 }
107107
108108 #
@@ -109,10 +109,10 @@
110110 #
111111
112112 $start_time = microtime();
113 -list($a_dec, $a_sec) = explode(" ", $start_time);
114 -$html = WikiHiero($text, $mode, $scale, $line);
115 -list($b_dec, $b_sec) = explode(" ", microtime());
116 -$process_time = sprintf("%0.3f sec", $b_sec - $a_sec + $b_dec - $a_dec);
 113+list( $a_dec, $a_sec ) = explode( " ", $start_time );
 114+$html = WikiHiero( $text, $mode, $scale, $line );
 115+list( $b_dec, $b_sec ) = explode( " ", microtime() );
 116+$process_time = sprintf( "%0.3f sec", $b_sec - $a_sec + $b_dec - $a_dec );
117117
118118 ?>
119119 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
@@ -143,83 +143,83 @@
144144 <TABLE border="0">
145145 <TR valign="top"><TD>
146146
147 - <BIG><?php echo "WikiHiero v".WH_VER_MAJ.".".WH_VER_MED.".".WH_VER_MIN; ?></BIG><br />
 147+ <BIG><?php echo "WikiHiero v" . WH_VER_MAJ . "." . WH_VER_MED . "." . WH_VER_MIN; ?></BIG><br />
148148 <SMALL>[<?php
149149
150 - reset($wh_language['Lang']);
151 - while($l = current($wh_language['Lang']))
 150+ reset( $wh_language['Lang'] );
 151+ while ( $l = current( $wh_language['Lang'] ) )
152152 {
153 - if(key($wh_language['Lang']) == $lang)
 153+ if ( key( $wh_language['Lang'] ) == $lang )
154154 echo "<b>$l</b>";
155155 else
156 - echo "<a href=\"javascript:LangLink('".key($wh_language['Lang'])."');\">$l</a>";
157 - next($wh_language['Lang']);
158 - $l = current($wh_language['Lang']);
159 - if( $l )
 156+ echo "<a href=\"javascript:LangLink('" . key( $wh_language['Lang'] ) . "');\">$l</a>";
 157+ next( $wh_language['Lang'] );
 158+ $l = current( $wh_language['Lang'] );
 159+ if ( $l )
160160 echo " | ";
161161 }
162162 ?>]</SMALL>
163163 <br /><br />
164164
165165 <form name="wh_form" action="index.php?lang=<?php echo $lang; ?>" method="post">
166 - <textarea name="text" cols="60" rows="10" title="<?php echo WH_Text("Text"); ?>"><?php echo $text; ?></textarea>
 166+ <textarea name="text" cols="60" rows="10" title="<?php echo WH_Text( "Text" ); ?>"><?php echo $text; ?></textarea>
167167 <br /><br />
168 - <input type="submit" title="<?php echo WH_Text("Convert"); ?>" value="<?php echo WH_Text("Convert"); ?>">
169 - <select title="<?php echo WH_Text("Mode"); ?>" name="mode">
170 - <option value="0" <?php if($mode==0) echo "selected"; ?> title="<?php echo WH_Text("TEXT"); ?>" onclick="javascript:DisableScale(true);">Text only
171 - <option value="1" <?php if($mode==1) echo "selected"; ?> title="<?php echo WH_Text("HTML"); ?>" onclick="javascript:DisableScale(false);">Simple HTML
172 - <option disabled value="2" <?php if($mode==2) echo "selected"; ?> title="<?php echo WH_Text("CSS"); ?>">HTML & CSS
173 - <option disabled value="3" <?php if($mode==3) echo "selected"; ?> title="<?php echo WH_Text("Image"); ?>">Image
 168+ <input type="submit" title="<?php echo WH_Text( "Convert" ); ?>" value="<?php echo WH_Text( "Convert" ); ?>">
 169+ <select title="<?php echo WH_Text( "Mode" ); ?>" name="mode">
 170+ <option value="0" <?php if ( $mode == 0 ) echo "selected"; ?> title="<?php echo WH_Text( "TEXT" ); ?>" onclick="javascript:DisableScale(true);">Text only
 171+ <option value="1" <?php if ( $mode == 1 ) echo "selected"; ?> title="<?php echo WH_Text( "HTML" ); ?>" onclick="javascript:DisableScale(false);">Simple HTML
 172+ <option disabled value="2" <?php if ( $mode == 2 ) echo "selected"; ?> title="<?php echo WH_Text( "CSS" ); ?>">HTML & CSS
 173+ <option disabled value="3" <?php if ( $mode == 3 ) echo "selected"; ?> title="<?php echo WH_Text( "Image" ); ?>">Image
174174 </select>
175 - <?php echo WH_Text("Scale"); ?><input type="range" name="scale" <?php if($mode==0) echo "disabled"; ?> title="<?php echo WH_Text("Size"); ?>" min="1" max="999" size="3" maxlength="3" value="<?php echo htmlspecialchars( $scale ); ?>">%
176 - <?php echo WH_Text("Line"); ?><input type="checkbox" name="line" <?php if($line) echo "checked"; ?>>
 175+ <?php echo WH_Text( "Scale" ); ?><input type="range" name="scale" <?php if ( $mode == 0 ) echo "disabled"; ?> title="<?php echo WH_Text( "Size" ); ?>" min="1" max="999" size="3" maxlength="3" value="<?php echo htmlspecialchars( $scale ); ?>">%
 176+ <?php echo WH_Text( "Line" ); ?><input type="checkbox" name="line" <?php if ( $line ) echo "checked"; ?>>
177177 <input type="hidden" name="lang" value="<?php echo htmlspecialchars( $lang ); ?>">
178178 </form>
179179
180180 </td><td valign="top">
181181
182 - <b><?php echo WH_Text("Syntax"); ?></b><br />
183 - <tt>-</tt> <?php echo WH_Text("-"); ?><br />
184 - <tt>:</tt> <?php echo WH_Text(":"); ?><br />
185 - <tt>*</tt> <?php echo WH_Text("*"); ?><br />
186 - <tt>!</tt> <?php echo WH_Text("!"); ?><br />
 182+ <b><?php echo WH_Text( "Syntax" ); ?></b><br />
 183+ <tt>-</tt> <?php echo WH_Text( "-" ); ?><br />
 184+ <tt>:</tt> <?php echo WH_Text( ":" ); ?><br />
 185+ <tt>*</tt> <?php echo WH_Text( "*" ); ?><br />
 186+ <tt>!</tt> <?php echo WH_Text( "!" ); ?><br />
187187
188188 <br />
189 - <b><?php echo WH_Text("Tables"); ?></b><br />
190 - <?php WH_Table("Phoneme"); ?>
191 - | <?php WH_Table("A"); ?>
192 - | <?php WH_Table("B"); ?>
193 - | <?php WH_Table("C"); ?>
194 - | <?php WH_Table("D"); ?>
195 - | <?php WH_Table("E"); ?>
196 - | <?php WH_Table("F"); ?>
197 - | <?php WH_Table("G"); ?>
198 - | <?php WH_Table("H"); ?>
199 - | <?php WH_Table("I"); ?>
200 - | <?php WH_Table("J"); ?>
201 - | <?php WH_Table("K"); ?>
202 - | <?php WH_Table("L"); ?>
203 - | <?php WH_Table("M"); ?>
204 - | <?php WH_Table("N"); ?>
205 - | <?php WH_Table("O"); ?>
206 - | <?php WH_Table("P"); ?>
207 - | <?php WH_Table("Q"); ?>
208 - | <?php WH_Table("R"); ?>
209 - | <?php WH_Table("S"); ?>
210 - | <?php WH_Table("T"); ?>
211 - | <?php WH_Table("U"); ?>
212 - | <?php WH_Table("V"); ?>
213 - | <?php WH_Table("W"); ?>
214 - | <?php WH_Table("X"); ?>
215 - | <?php WH_Table("Y"); ?>
216 - | <?php WH_Table("Z"); ?>
217 - | <?php WH_Table("Aa"); ?>
218 - | <?php WH_Table("All"); ?>
 189+ <b><?php echo WH_Text( "Tables" ); ?></b><br />
 190+ <?php WH_Table( "Phoneme" ); ?>
 191+ | <?php WH_Table( "A" ); ?>
 192+ | <?php WH_Table( "B" ); ?>
 193+ | <?php WH_Table( "C" ); ?>
 194+ | <?php WH_Table( "D" ); ?>
 195+ | <?php WH_Table( "E" ); ?>
 196+ | <?php WH_Table( "F" ); ?>
 197+ | <?php WH_Table( "G" ); ?>
 198+ | <?php WH_Table( "H" ); ?>
 199+ | <?php WH_Table( "I" ); ?>
 200+ | <?php WH_Table( "J" ); ?>
 201+ | <?php WH_Table( "K" ); ?>
 202+ | <?php WH_Table( "L" ); ?>
 203+ | <?php WH_Table( "M" ); ?>
 204+ | <?php WH_Table( "N" ); ?>
 205+ | <?php WH_Table( "O" ); ?>
 206+ | <?php WH_Table( "P" ); ?>
 207+ | <?php WH_Table( "Q" ); ?>
 208+ | <?php WH_Table( "R" ); ?>
 209+ | <?php WH_Table( "S" ); ?>
 210+ | <?php WH_Table( "T" ); ?>
 211+ | <?php WH_Table( "U" ); ?>
 212+ | <?php WH_Table( "V" ); ?>
 213+ | <?php WH_Table( "W" ); ?>
 214+ | <?php WH_Table( "X" ); ?>
 215+ | <?php WH_Table( "Y" ); ?>
 216+ | <?php WH_Table( "Z" ); ?>
 217+ | <?php WH_Table( "Aa" ); ?>
 218+ | <?php WH_Table( "All" ); ?>
219219 <br /><br />
220220
221 - <b><?php echo WH_Text("Download"); ?></b><br />
222 - [<?php echo WH_Packet("rar"); ?>] -
223 - [<?php echo WH_Packet("zip"); ?>] -
 221+ <b><?php echo WH_Text( "Download" ); ?></b><br />
 222+ [<?php echo WH_Packet( "rar" ); ?>] -
 223+ [<?php echo WH_Packet( "zip" ); ?>] -
224224 <a href="README">ReadMe</a>
225225
226226 </td></tr>
@@ -240,7 +240,7 @@
241241 <table width="100%" border="0" cellpadding="0" cellspacing="0" style="border-style:solid; border-width:1px; padding:1em; border-color:gray; background:#ffffff;">
242242 <tr valign="middle"><td>
243243
244 - <pre><?php echo htmlentities($html); ?></pre>
 244+ <pre><?php echo htmlentities( $html ); ?></pre>
245245
246246 </td></tr>
247247 </table>
Index: trunk/extensions/wikihiero/wh_generate.php
@@ -2,22 +2,22 @@
33
44 //////////////////////////////////////////////////////////////////////////
55 //
6 -// WikiHiero - A PHP convert from text using "Manual for the encoding of
 6+// WikiHiero - A PHP convert from text using "Manual for the encoding of
77 // hieroglyphic texts for computer input" syntax to HTML entities (table and
88 // images).
99 //
1010 // Copyright (C) 2004 Guillaume Blanchard (Aoineko)
11 -//
 11+//
1212 // This program is free software; you can redistribute it and/or
1313 // modify it under the terms of the GNU General Public License
1414 // as published by the Free Software Foundation; either version 2
1515 // of the License, or any later version.
16 -//
 16+//
1717 // This program is distributed in the hope that it will be useful,
1818 // but WITHOUT ANY WARRANTY; without even the implied warranty of
1919 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2020 // GNU General Public License for more details.
21 -//
 21+//
2222 // You should have received a copy of the GNU General Public License
2323 // along with this program; if not, write to the Free Software
2424 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
@@ -30,7 +30,7 @@
3131
3232 include "wh_main.php";
3333
34 -if(array_key_exists("lang", $_GET)) {
 34+if ( array_key_exists( "lang", $_GET ) ) {
3535 $lang = $_GET["lang"];
3636 } else {
3737 $lang = "fr";
@@ -44,7 +44,7 @@
4545 </head>
4646 <body bgcolor="#DDDDDD">
4747
48 - <big><?php echo "WikiHiero v".WH_VER_MAJ.".".WH_VER_MED.".".WH_VER_MIN; ?></big>
 48+ <big><?php echo "WikiHiero v" . WH_VER_MAJ . "." . WH_VER_MED . "." . WH_VER_MIN; ?></big>
4949
5050 <br /><br />Parsing hieroglyph files and creating tables...<br /><br />
5151
@@ -53,24 +53,24 @@
5454 $wh_prefabs = "\$wh_prefabs = array(\n";
5555 $wh_files = "\$wh_files = array(\n";
5656
57 - $img_dir = dirname(__FILE__) . '/img/';
 57+ $img_dir = dirname( __FILE__ ) . '/img/';
5858
59 - if(is_dir($img_dir))
 59+ if ( is_dir( $img_dir ) )
6060 {
61 - $dh = opendir($img_dir);
 61+ $dh = opendir( $img_dir );
6262 if ( $dh )
6363 {
64 - while (($file = readdir($dh)) !== false)
 64+ while ( ( $file = readdir( $dh ) ) !== false )
6565 {
66 - if(stristr($file, WH_IMG_EXT))
 66+ if ( stristr( $file, WH_IMG_EXT ) )
6767 {
68 - list($width, $height, $type, $attr) = getimagesize($img_dir.$file);
69 - $wh_files .= " \"".WH_GetCode($file)."\" => array( $width, $height ),\n";
70 - if(strchr($file,'&'))
71 - $wh_prefabs .= " \"".WH_GetCode($file)."\",\n";
 68+ list( $width, $height, $type, $attr ) = getimagesize( $img_dir . $file );
 69+ $wh_files .= " \"" . WH_GetCode( $file ) . "\" => array( $width, $height ),\n";
 70+ if ( strchr( $file, '&' ) )
 71+ $wh_prefabs .= " \"" . WH_GetCode( $file ) . "\",\n";
7272 }
7373 }
74 - closedir($dh);
 74+ closedir( $dh );
7575 }
7676 }
7777
@@ -80,17 +80,17 @@
8181 echo "<pre>$wh_prefabs<br /><br />";
8282 echo "$wh_files<br /><br /></pre>";
8383
84 - $file = fopen("wh_list.php", "w+");
85 - fwrite($file, "<?php\n\n");
86 - fwrite($file, "// File created by wh_generate.php version ".WH_VER_MAJ.".".WH_VER_MED.".".WH_VER_MIN."\n");
87 - fwrite($file, "// ".date("Y/m/d at H:i")."\n\n");
88 - fwrite($file, "global \$wh_prefabs, \$wh_files;\n\n");
89 - fwrite($file, "$wh_prefabs\n\n");
90 - fwrite($file, "$wh_files\n\n");
91 - fwrite($file, "?>");
92 - fclose($file);
 84+ $file = fopen( "wh_list.php", "w+" );
 85+ fwrite( $file, "<?php\n\n" );
 86+ fwrite( $file, "// File created by wh_generate.php version " . WH_VER_MAJ . "." . WH_VER_MED . "." . WH_VER_MIN . "\n" );
 87+ fwrite( $file, "// " . date( "Y/m/d at H:i" ) . "\n\n" );
 88+ fwrite( $file, "global \$wh_prefabs, \$wh_files;\n\n" );
 89+ fwrite( $file, "$wh_prefabs\n\n" );
 90+ fwrite( $file, "$wh_files\n\n" );
 91+ fwrite( $file, "?>" );
 92+ fclose( $file );
9393
94 - //if(file_exists("wh_list(0).php"))
 94+ // if(file_exists("wh_list(0).php"))
9595
9696 ?>
9797

Status & tagging log