ライセンス署名追加
@@ -1,7 +1,10 @@ | ||
1 | 1 | <?php |
2 | 2 | /*------------------------------------------------------------------------------+ |
3 | - *<meta http-equiv="Content-Type" content="text/php; charset=utf-8"> | |
3 | + <meta http-equiv="Content-Type" content="text/php; charset=utf-8"> | |
4 | 4 | |
5 | + text2html てきでこ Akio Tenman. <http://text2html.sourceforge.jp/> | |
6 | + Copyright (C) 2008 Akio Tenman <tenman@users.sourceforge.jp> | |
7 | + | |
5 | 8 | This program is free software: you can redistribute it and/or modify |
6 | 9 | it under the terms of the GNU General Public License as published by |
7 | 10 | the Free Software Foundation, either version 3 of the License, or |
@@ -14,23 +17,23 @@ | ||
14 | 17 | |
15 | 18 | You should have received a copy of the GNU General Public License |
16 | 19 | along with this program. If not, see <http://www.gnu.org/licenses/>. |
17 | - *------------------------------------------------------------------------------*/ | |
20 | + +------------------------------------------------------------------------------*/ | |
18 | 21 | //このアプリで、外部API等を参照する場合、allow_url_fopenはtrueである必要があります。 |
19 | 22 | |
20 | 23 | mb_language( 'Japanese' ); |
21 | - | |
24 | + | |
22 | 25 | if(preg_match("/^[A-z]:.+/",__FILE__)){ |
23 | - $separater = '\\'; | |
26 | + $separater = '\\'; | |
24 | 27 | }else{ |
25 | - $separater = '/'; | |
28 | + $separater = '/'; | |
26 | 29 | } |
27 | - | |
28 | - if(!isset($text2html_url)){ | |
29 | - $text2html_url = "http://". $_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF']).$separater; | |
30 | + | |
31 | + if(!isset($text2html_url)){ | |
32 | + $text2html_url = "http://". $_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF']).$separater; | |
30 | 33 | } |
31 | 34 | |
32 | - if(!isset($text2html_dir_path)){ | |
33 | - $text2html_dir_path = dirname(dirname(__FILE__)).$separater; | |
35 | + if(!isset($text2html_dir_path)){ | |
36 | + $text2html_dir_path = dirname(dirname(__FILE__)).$separater; | |
34 | 37 | } |
35 | 38 | |
36 | 39 | if(!isset($cache)){ |
@@ -120,47 +123,47 @@ | ||
120 | 123 | var $attr; |
121 | 124 | var $content_attr; |
122 | 125 | var $description; |
123 | - var $copy_target; | |
124 | - var $copy_uri; | |
126 | + var $copy_target; | |
127 | + var $copy_uri; | |
125 | 128 | |
126 | 129 | |
127 | - function trans($document){ | |
130 | + function trans($document){ | |
128 | 131 | |
129 | - $document = str_replace(array("\r"),"\n",$document); | |
130 | - $document = $this->tag_br($document); | |
131 | - $this->document = $this->tag_clear($document); | |
132 | + $document = str_replace(array("\r"),"\n",$document); | |
133 | + $document = $this->tag_br($document); | |
134 | + $this->document = $this->tag_clear($document); | |
132 | 135 | } |
133 | 136 | |
134 | 137 | function delete_break($matches){ |
135 | 138 | $result = ""; |
136 | - | |
137 | - foreach($matches as $key=>$match){ | |
138 | - if($key==0){ | |
139 | - $result .= str_replace("\n","",$match); | |
140 | - } | |
141 | - } | |
142 | - | |
143 | - $result = preg_replace("/\s{2,}/"," ",$result); | |
144 | - | |
145 | - return $result; | |
139 | + | |
140 | + foreach($matches as $key=>$match){ | |
141 | + if($key==0){ | |
142 | + $result .= str_replace("\n","",$match); | |
143 | + } | |
144 | + } | |
145 | + | |
146 | + $result = preg_replace("/\s{2,}/"," ",$result); | |
147 | + | |
148 | + return $result; | |
146 | 149 | } |
147 | 150 | |
148 | 151 | function tag_br($text){ |
149 | - $text = str_replace("\r","",$text); | |
150 | - $text = preg_replace("/\s=/","=",$text); | |
151 | - $text = preg_replace_callback("/[^(code:)](<[^>]+\s{2,}[^>]+>)/usi",array($this, 'delete_break'),$text); | |
152 | + $text = str_replace("\r","",$text); | |
153 | + $text = preg_replace("/\s=/","=",$text); | |
154 | + $text = preg_replace_callback("/[^(code:)](<[^>]+\s{2,}[^>]+>)/usi",array($this, 'delete_break'),$text); | |
152 | 155 | |
153 | - return $text; | |
156 | + return $text; | |
154 | 157 | |
155 | 158 | } |
156 | 159 | |
157 | 160 | function get_querys($text){ |
158 | 161 | |
159 | - if(ini_get("allow_url_fopen") == false){ | |
160 | - | |
161 | - return $text; | |
162 | - } | |
162 | + if(ini_get("allow_url_fopen") == false){ | |
163 | 163 | |
164 | + return $text; | |
165 | + } | |
166 | + | |
164 | 167 | //重複名の誤変換を避けるために、文字数の長い順にソート |
165 | 168 | $get_querys = array( |
166 | 169 | /*キー名は10文字未満*/ |
@@ -207,22 +210,22 @@ | ||
207 | 210 | 'url'=>'http://www.odekake.biz/branch/?date=+++E_KEYWORD+++', |
208 | 211 | "response"=>"+++CONTENTS+++\n"), |
209 | 212 | ); |
210 | - | |
213 | + | |
211 | 214 | uksort($get_querys,"text2html_cmp"); |
212 | 215 | |
213 | 216 | if(isset($get_querys)){ |
214 | 217 | foreach($get_querys as $key=>$val){ |
215 | 218 | if(preg_match_all("/($key>\()([^\)]+)(\))/u", $text, $matches, PREG_SET_ORDER)){ |
216 | - | |
219 | + | |
217 | 220 | foreach($matches as $key=>$match){ |
218 | - | |
221 | + | |
219 | 222 | $cache = use_cache($matches[$key][0]); |
220 | 223 | if($cache[0]){ |
221 | - | |
222 | - $text = str_replace($matches[$key][0],$cache[1],$text)."\n"; | |
224 | + | |
225 | + $text = str_replace($matches[$key][0],$cache[1],$text)."\n"; | |
223 | 226 | }else{ |
224 | - | |
225 | - $enc = mb_convert_encoding($match[2],$val['charset'],"auto"); | |
227 | + | |
228 | + $enc = mb_convert_encoding($match[2],$val['charset'],"auto"); | |
226 | 229 | $no_enc = mb_convert_encoding($match[2],"UTF-8","auto"); |
227 | 230 | $no_enc = str_replace("\n","",$no_enc); |
228 | 231 |
@@ -230,7 +233,7 @@ | ||
230 | 233 | |
231 | 234 | case('link'): |
232 | 235 | |
233 | - $enc = urlencode($enc); | |
236 | + $enc = urlencode($enc); | |
234 | 237 | $replacement = mb_convert_encoding($val['response'],"UTF-8","auto"); |
235 | 238 | $replacement = str_replace(array("+++E_KEYWORD+++","+++KEYWORD+++"),array($enc,$no_enc),$val['response']); |
236 | 239 | $replacement = trim($replacement); |
@@ -238,24 +241,24 @@ | ||
238 | 241 | |
239 | 242 | case('contents'): |
240 | 243 | |
241 | - $enc = urlencode($enc); | |
242 | - $target = mb_convert_encoding($val['url'],"UTF-8","auto"); | |
243 | - $target = str_replace(array("+++E_KEYWORD+++","+++KEYWORD+++"),array($enc,$no_enc),$target); | |
244 | - $host = parse_url($target); | |
245 | - $host = $host['host']; | |
246 | - | |
244 | + $enc = urlencode($enc); | |
245 | + $target = mb_convert_encoding($val['url'],"UTF-8","auto"); | |
246 | + $target = str_replace(array("+++E_KEYWORD+++","+++KEYWORD+++"),array($enc,$no_enc),$target); | |
247 | + $host = parse_url($target); | |
248 | + $host = $host['host']; | |
249 | + | |
247 | 250 | try{ |
248 | 251 | |
249 | 252 | if(!$fp = fsockopen ($host, 80, $errno, $errstr, 5)){ |
250 | - | |
253 | + | |
251 | 254 | throw new Exception('を、取得できません。サービスを停止してるかどうか確認してください。'); |
252 | 255 | } |
253 | - | |
256 | + | |
254 | 257 | socket_set_timeout($fp, 3); |
255 | 258 | fputs ($fp, "GET / HTTP/1.0\r\nHost: ".$_SERVER['HTTP_HOST']."\r\n\r\n"); |
256 | - $replacement = mb_convert_encoding(file_get_contents($target),"UTF-8","auto"); | |
257 | - $stat = socket_get_status($fp); | |
258 | - | |
259 | + $replacement = mb_convert_encoding(file_get_contents($target),"UTF-8","auto"); | |
260 | + $stat = socket_get_status($fp); | |
261 | + | |
259 | 262 | if ($stat["timed_out"]) { |
260 | 263 | |
261 | 264 | throw new Exception('タイムアウトしました。'); |
@@ -264,77 +267,77 @@ | ||
264 | 267 | fclose($fp); |
265 | 268 | |
266 | 269 | }catch (Exception $e) { |
267 | - | |
270 | + | |
268 | 271 | $errstr = mb_convert_encoding($errstr,"UTF-8","auto"); |
269 | 272 | echo '<div style="text-align:left;padding:2em;background:#FF99FF;">例外: ',$target,$e->getMessage(), "\n</div>\n"; |
270 | 273 | } |
271 | 274 | |
272 | 275 | break; |
273 | - | |
276 | + | |
274 | 277 | case('query'): |
275 | 278 | |
276 | - $replacement = mb_convert_encoding($val['response'],"UTF-8","auto"); | |
277 | - $querys = explode("&",$enc); | |
278 | - $enc = ""; | |
279 | - | |
280 | - foreach($querys as $query){ | |
281 | - | |
282 | - preg_match("/([^=]+)(=)(.+)/", $query, $hit); | |
283 | - | |
284 | - if($hit){ | |
285 | - $enc .= '&'.urlencode($hit[1]).$hit[2].urlencode($hit[3]); | |
286 | - } | |
287 | - | |
288 | - } | |
279 | + $replacement = mb_convert_encoding($val['response'],"UTF-8","auto"); | |
280 | + $querys = explode("&",$enc); | |
281 | + $enc = ""; | |
289 | 282 | |
290 | - $enc = str_replace("\n","",$enc); | |
291 | - $no_enc = ""; | |
292 | - $replacement = str_replace(array("+++E_KEYWORD+++","+++KEYWORD+++"),array($enc,$no_enc),$val['response']); | |
283 | + foreach($querys as $query){ | |
293 | 284 | |
285 | + preg_match("/([^=]+)(=)(.+)/", $query, $hit); | |
286 | + | |
287 | + if($hit){ | |
288 | + $enc .= '&'.urlencode($hit[1]).$hit[2].urlencode($hit[3]); | |
289 | + } | |
290 | + | |
291 | + } | |
292 | + | |
293 | + $enc = str_replace("\n","",$enc); | |
294 | + $no_enc = ""; | |
295 | + $replacement = str_replace(array("+++E_KEYWORD+++","+++KEYWORD+++"),array($enc,$no_enc),$val['response']); | |
296 | + | |
294 | 297 | break; |
295 | 298 | |
296 | 299 | case('contents_rebuild'): |
297 | 300 | |
298 | - $enc = urlencode($enc); | |
301 | + $enc = urlencode($enc); | |
299 | 302 | $replacement = mb_convert_encoding($val['response'],"UTF-8","auto"); |
300 | - $target = str_replace(array("+++E_KEYWORD+++","+++KEYWORD+++"),array($enc,$no_enc),$val['url']); | |
303 | + $target = str_replace(array("+++E_KEYWORD+++","+++KEYWORD+++"),array($enc,$no_enc),$val['url']); | |
301 | 304 | |
302 | - $host = parse_url($target); | |
303 | - $host = $host['host']; | |
304 | - | |
305 | + $host = parse_url($target); | |
306 | + $host = $host['host']; | |
307 | + | |
305 | 308 | try{ |
306 | 309 | |
307 | 310 | if(!$fp = fsockopen ($host, 80, $errno, $errstr, 5)){ |
308 | - | |
311 | + | |
309 | 312 | throw new Exception('を、取得できません。サービスを停止してるかどうか確認してください。'); |
310 | 313 | } |
311 | - | |
314 | + | |
312 | 315 | socket_set_timeout($fp, 3); |
313 | 316 | fputs ($fp, "GET / HTTP/1.0\r\nHost: ".$_SERVER['HTTP_HOST']."\r\n\r\n"); |
314 | 317 | |
315 | - $replacement = mb_convert_encoding(@file_get_contents($target),"UTF-8","auto"); | |
316 | - $function_name = $val['function']; | |
317 | - $replacement = $function_name($replacement); | |
318 | + $replacement = mb_convert_encoding(@file_get_contents($target),"UTF-8","auto"); | |
319 | + $function_name = $val['function']; | |
320 | + $replacement = $function_name($replacement); | |
318 | 321 | |
319 | 322 | $stat = socket_get_status($fp); |
320 | - | |
321 | - if ($stat["timed_out"]) { | |
322 | - | |
323 | - throw new Exception('タイムアウトしました。'); | |
324 | - } | |
325 | 323 | |
324 | + if ($stat["timed_out"]) { | |
325 | + | |
326 | + throw new Exception('タイムアウトしました。'); | |
327 | + } | |
328 | + | |
326 | 329 | fclose($fp); |
327 | 330 | |
328 | 331 | |
329 | 332 | }catch (Exception $e) { |
330 | - | |
331 | - $errstr = mb_convert_encoding($errstr,"UTF-8","auto"); | |
333 | + | |
334 | + $errstr = mb_convert_encoding($errstr,"UTF-8","auto"); | |
332 | 335 | echo '<div style="text-align:left;padding:2em;background:#FF99FF;">例外: ',$target,$e->getMessage(), "\n</div>\n"; |
333 | 336 | } |
334 | 337 | break; |
335 | 338 | |
336 | 339 | } |
337 | - | |
340 | + | |
338 | 341 | save_cache($matches[$key][0],$replacement); |
339 | 342 | |
340 | 343 | $text = str_replace($matches[$key][0],$replacement,$text)."\n"; |
@@ -357,16 +360,16 @@ | ||
357 | 360 | } |
358 | 361 | |
359 | 362 | function text2html(){ |
360 | - | |
363 | + | |
361 | 364 | global $benchmark; |
362 | 365 | global $source; |
363 | - global $content_name; | |
364 | - | |
366 | + global $content_name; | |
367 | + | |
365 | 368 | $pear_file = ""; |
366 | 369 | $timer = false; |
367 | - $buffer = $this->document; | |
370 | + $buffer = $this->document; | |
368 | 371 | $output_enc = "UTF-8"; |
369 | - | |
372 | + | |
370 | 373 | if(isset($benchmark) and $benchmark == true){ |
371 | 374 | include_once ("Benchmark/Timer.php"); |
372 | 375 | $timer = true; |
@@ -385,7 +388,7 @@ | ||
385 | 388 | if($timer){ $oTimer->setMarker( 'text2html_table' );} |
386 | 389 | //blockquote |
387 | 390 | $buffer = $this->text2html_code($buffer,"\n","pre",'code:','code','','class="source"','souce'); |
388 | - | |
391 | + | |
389 | 392 | if($timer){ $oTimer->setMarker( 'text2html_code' );} |
390 | 393 | //heading |
391 | 394 | $buffer = $this->text2html_element($buffer,"\n","h6",'\*\*\*\*\*','a','', 'href="#TOP"','h6'); |
@@ -420,7 +423,7 @@ | ||
420 | 423 | asort($this->header_info); |
421 | 424 | $this->midasilist = "<a name=\"TOP\" id=\"TOP\" >head line</a>\n"; |
422 | 425 | $kihou = ""; |
423 | - | |
426 | + | |
424 | 427 | foreach($this->header_info as $key=>$link){ |
425 | 428 | |
426 | 429 | $kihou = str_repeat ('+', $link[1]-1); |
@@ -440,17 +443,17 @@ | ||
440 | 443 | break; |
441 | 444 | |
442 | 445 | case(count($end) > count($start)): |
443 | - //閉じタグが多い | |
444 | - $rep = $rep; | |
445 | - $rep = str_repeat("<\/ol><\/li>",$rep + 1); | |
446 | - $this->midasilist = preg_replace("/$rep<\/ol>$/m","</ol>",$this->midasilist); | |
446 | + //閉じタグが多い | |
447 | + $rep = $rep; | |
448 | + $rep = str_repeat("<\/ol><\/li>",$rep + 1); | |
449 | + $this->midasilist = preg_replace("/$rep<\/ol>$/m","</ol>",$this->midasilist); | |
447 | 450 | |
448 | 451 | break; |
449 | 452 | |
450 | 453 | case(count($end) < count($start)): |
451 | - //閉じタグが少ない | |
452 | - $rep = str_repeat('</ol></li>',abs($rep)-1); | |
453 | - $this->midasilist = preg_replace("/<\/ol>$/m","",$this->midasilist).$rep."</ol>"; | |
454 | + //閉じタグが少ない | |
455 | + $rep = str_repeat('</ol></li>',abs($rep)-1); | |
456 | + $this->midasilist = preg_replace("/<\/ol>$/m","",$this->midasilist).$rep."</ol>"; | |
454 | 457 | |
455 | 458 | break; |
456 | 459 | } |
@@ -472,7 +475,7 @@ | ||
472 | 475 | |
473 | 476 | $buffer = $this->keyword_change($buffer,"\n"); |
474 | 477 | if($timer){$oTimer->setMarker( 'keyword_change' );} |
475 | - | |
478 | + | |
476 | 479 | $buffer = $this->read_php($buffer,"\n"); |
477 | 480 | if($timer){$oTimer->setMarker( 'read_php' );} |
478 | 481 |
@@ -517,7 +520,7 @@ | ||
517 | 520 | |
518 | 521 | $buffer = $this->clear_both($buffer,"\n"); |
519 | 522 | if($timer){$oTimer->setMarker( 'clear_both' );} |
520 | - | |
523 | + | |
521 | 524 | $buffer = $this->get_querys($buffer,"\n"); |
522 | 525 | if($timer){$oTimer->setMarker( 'get_querys' );} |
523 | 526 |
@@ -526,7 +529,7 @@ | ||
526 | 529 | $buffer = $this->text2html_list($buffer,"\n","ul",'※','li','style="font:size:70%;color:#66f;"',"style=\"list-style-type:none;\"","caution"); |
527 | 530 | if($timer){$oTimer->setMarker( 'list' );} |
528 | 531 | |
529 | - //$buffer = $this->text2html_list2($buffer,"\n","blockquote",'引用:','p','','','quote'); | |
532 | + //$buffer = $this->text2html_list2($buffer,"\n","blockquote",'引用:','p','','','quote'); | |
530 | 533 | //入れ子可 |
531 | 534 | $buffer = $this->text2html_list($buffer,"\n","blockquote",'>','p','','','quote'); |
532 | 535 | if($timer){$oTimer->setMarker( 'list_blockquote' );} |
@@ -541,7 +544,7 @@ | ||
541 | 544 | if($timer){$oTimer->setMarker( 'result_encoding' );} |
542 | 545 | |
543 | 546 | if(isset($source) and $source == true){ |
544 | - | |
547 | + | |
545 | 548 | $source = $this->my_wordwrap($text); |
546 | 549 | $source = str_replace("/",'/',$source); |
547 | 550 |
@@ -548,7 +551,7 @@ | ||
548 | 551 | $this->source = '<div class="source_view">'. |
549 | 552 | $this->style_set($source)."\n</div>"; |
550 | 553 | }else{ |
551 | - | |
554 | + | |
552 | 555 | $this->source = ""; |
553 | 556 | } |
554 | 557 | if($timer){$oTimer->setMarker( 'create_source' );} |
@@ -568,17 +571,17 @@ | ||
568 | 571 | |
569 | 572 | function change_word($text){ |
570 | 573 | |
571 | - if(!defined('TEXTTOHTML_CHANGE_TXT')){return $text;} | |
572 | - $file = TEXTTOHTML_CHANGE_TXT; | |
574 | + if(!defined('TEXTTOHTML_CHANGE_TXT')){return $text;} | |
575 | + $file = TEXTTOHTML_CHANGE_TXT; | |
573 | 576 | |
574 | 577 | if(file_exists($file)){ |
575 | - | |
578 | + | |
576 | 579 | $chenge_words = file($file); |
577 | 580 | |
578 | 581 | foreach($chenge_words as $chenge_word){ |
579 | - | |
580 | - $chenge_word = mb_convert_encoding($chenge_word, "UTF-8","auto"); | |
581 | 582 | |
583 | + $chenge_word = mb_convert_encoding($chenge_word, "UTF-8","auto"); | |
584 | + | |
582 | 585 | if(strstr($chenge_word,"#")){ |
583 | 586 | list($before, $after) = explode("#", $chenge_word); |
584 | 587 | $text = str_replace($before , trim($after), $text); |
@@ -587,7 +590,7 @@ | ||
587 | 590 | |
588 | 591 | return $text; |
589 | 592 | }else{ |
590 | - | |
593 | + | |
591 | 594 | return $text; |
592 | 595 | } |
593 | 596 |
@@ -634,7 +637,7 @@ | ||
634 | 637 | $line = $line."\n"; |
635 | 638 | if($current_flag = preg_match("/^([$wm]+)(.+)/u",$line,$current)){ |
636 | 639 | |
637 | - $marker_length = @strlen($current[1]); | |
640 | + $marker_length = @strlen($current[1]); | |
638 | 641 | |
639 | 642 | |
640 | 643 | //リスト変換のオンオフ判定 |
@@ -904,12 +907,12 @@ | ||
904 | 907 | $description = $description.$content_name; |
905 | 908 | } |
906 | 909 | |
907 | - $lines = explode($separator,$document); | |
908 | - $start = true; | |
909 | - $this->content_no = 1; | |
910 | - $start_tag = "<{$element} $attr id=\"$element-$description-".$this->content_no."\">"; | |
911 | - $end_tag = ''; | |
912 | - $result = ""; | |
910 | + $lines = explode($separator,$document); | |
911 | + $start = true; | |
912 | + $this->content_no = 1; | |
913 | + $start_tag = "<{$element} $attr id=\"$element-$description-".$this->content_no."\">"; | |
914 | + $end_tag = ''; | |
915 | + $result = ""; | |
913 | 916 | |
914 | 917 | foreach($lines as $list){ |
915 | 918 |
@@ -919,30 +922,30 @@ | ||
919 | 922 | |
920 | 923 | if(!empty($content)){ |
921 | 924 | |
922 | - $start_content = "<$content>"; | |
923 | - $end_content = "</$content>\n"; | |
925 | + $start_content = "<$content>"; | |
926 | + $end_content = "</$content>\n"; | |
924 | 927 | }else{ |
925 | - | |
926 | - $start_content = ""; | |
927 | - $end_content = ""; | |
928 | + | |
929 | + $start_content = ""; | |
930 | + $end_content = ""; | |
928 | 931 | } |
929 | 932 | |
930 | 933 | $res = $this->text2html_list($regs[2],$this->separator,$this->element,$this->wm,$this->content,$this->attr,$this->content_attr,$this->description); |
931 | 934 | |
932 | - $list = str_replace($regs[0],$start_tag.$start_content.trim($this->sublist($res)).$end_content,$list); | |
933 | - $start_tag = ""; | |
934 | - $end_tag = "</{$element}>"; | |
935 | + $list = str_replace($regs[0],$start_tag.$start_content.trim($this->sublist($res)).$end_content,$list); | |
936 | + $start_tag = ""; | |
937 | + $end_tag = "</{$element}>"; | |
935 | 938 | |
936 | 939 | }elseif(!empty($end_tag)){ |
937 | 940 | |
938 | - $list = $end_tag."\n".$list; | |
941 | + $list = $end_tag."\n".$list; | |
939 | 942 | $this->content_no++; |
940 | - $end_tag = ''; | |
941 | - $start_tag = "<{$element} $attr id=\"$element-$description-".$this->content_no."\">"; | |
943 | + $end_tag = ''; | |
944 | + $start_tag = "<{$element} $attr id=\"$element-$description-".$this->content_no."\">"; | |
942 | 945 | }else{ |
943 | - | |
944 | - $start_tag = "<{$element} $attr id=\"$element-$description-".$this->content_no."\">"; | |
945 | 946 | |
947 | + $start_tag = "<{$element} $attr id=\"$element-$description-".$this->content_no."\">"; | |
948 | + | |
946 | 949 | } |
947 | 950 | |
948 | 951 | $result .= $list; |
@@ -957,36 +960,36 @@ | ||
957 | 960 | $element = $this->element; |
958 | 961 | $wm = $this->wm; |
959 | 962 | $content = $this->content; |
960 | - $start = true; | |
961 | - $lines = explode($separator,$document); | |
962 | - $end_tag = ""; | |
963 | - $result = ""; | |
964 | - $class = ""; | |
963 | + $start = true; | |
964 | + $lines = explode($separator,$document); | |
965 | + $end_tag = ""; | |
966 | + $result = ""; | |
967 | + $class = ""; | |
965 | 968 | |
966 | - foreach($lines as $key=>$list){ | |
969 | + foreach($lines as $key=>$list){ | |
967 | 970 | |
968 | - $list = $list. "\n"; | |
971 | + $list = $list. "\n"; | |
969 | 972 | |
970 | 973 | if(ereg("(^$wm{1})(.+)",$list,$regs)){ |
971 | 974 | |
972 | - if($start == false){$start_tag = "";}else{$start_tag = "<$element>";} | |
973 | - | |
974 | - if(!ereg("(^$wm{1})(.+)",$lines[$key+1])){$end_tag= "</$element>";}else{$end_tag= "";} | |
975 | - | |
976 | - if(!empty($content)){ | |
977 | - | |
978 | - $start_content = "<$content>"; | |
979 | - $end_content = "</$content>"; | |
980 | - }else{ | |
981 | - | |
982 | - $start_content = ""; | |
983 | - $end_content = ""; | |
984 | - } | |
975 | + if($start == false){$start_tag = "";}else{$start_tag = "<$element>";} | |
985 | 976 | |
977 | + if(!ereg("(^$wm{1})(.+)",$lines[$key+1])){$end_tag= "</$element>";}else{$end_tag= "";} | |
978 | + | |
979 | + if(!empty($content)){ | |
980 | + | |
981 | + $start_content = "<$content>"; | |
982 | + $end_content = "</$content>"; | |
983 | + }else{ | |
984 | + | |
985 | + $start_content = ""; | |
986 | + $end_content = ""; | |
987 | + } | |
988 | + | |
986 | 989 | $list= str_replace($regs[0],$start_tag.$start_content.trim($this->sublist($regs[2]))."\n".$end_content,$list); |
987 | 990 | |
988 | 991 | $start = false; |
989 | - | |
992 | + | |
990 | 993 | }elseif(!empty($end_tag)){ |
991 | 994 | |
992 | 995 | $list = $end_tag. "\n".$list; |
@@ -993,9 +996,9 @@ | ||
993 | 996 | } |
994 | 997 | $result .= $list; |
995 | 998 | |
996 | - } | |
999 | + } | |
997 | 1000 | |
998 | - return $this->tag_clear($result); | |
1001 | + return $this->tag_clear($result); | |
999 | 1002 | } |
1000 | 1003 | |
1001 | 1004 | function text2html_code($document = "", $separator = "\n",$element = "pre",$wm = 'code:',$content = 'code',$attr = '',$content_attr = '',$description = ''){ |
@@ -1007,21 +1010,21 @@ | ||
1007 | 1010 | global $content_name; |
1008 | 1011 | |
1009 | 1012 | if(!empty($content_name) and !empty($description)){ |
1010 | - $description = $description.'-'.$content_name; | |
1013 | + $description = $description.'-'.$content_name; | |
1011 | 1014 | }else{ |
1012 | - $description = $description.$content_name; | |
1015 | + $description = $description.$content_name; | |
1013 | 1016 | } |
1014 | 1017 | |
1015 | - $i = 0; | |
1016 | - $lines = explode($separator,$document); | |
1017 | - $start = true; | |
1018 | + $i = 0; | |
1019 | + $lines = explode($separator,$document); | |
1020 | + $start = true; | |
1018 | 1021 | $this->content_no = 1; |
1019 | - $start_tag = "<{$element} $attr id=\"$element-$description-".trim($this->content_no)."\">"; | |
1020 | - $end_tag = ''; | |
1021 | - $result = ""; | |
1022 | + $start_tag = "<{$element} $attr id=\"$element-$description-".trim($this->content_no)."\">"; | |
1023 | + $end_tag = ''; | |
1024 | + $result = ""; | |
1022 | 1025 | |
1023 | 1026 | foreach($lines as $list){ |
1024 | - | |
1027 | + | |
1025 | 1028 | $list = $list. "\n"; |
1026 | 1029 | |
1027 | 1030 | if(preg_match("/(^$wm{1})(.+)/um",$list,$regs)){ |
@@ -1035,26 +1038,26 @@ | ||
1035 | 1038 | $end_content = "\n"; |
1036 | 1039 | } |
1037 | 1040 | |
1038 | - $doc = $regs[2]; | |
1039 | - $doc = $this->my_wordwrap($doc); | |
1040 | - $doc = htmlspecialchars($doc); | |
1041 | - $doc = str_replace(array('/',"\t",'$','<'),array("/"," ",'$','&#lt'),$doc); | |
1042 | - $doc = str_replace("\n","</code><code>",$doc);//ワードラップは、改行だけ埋め込むので、タグを補充 | |
1043 | - $list = str_replace($regs[0],$start_tag.$start_content.trim($doc).$end_content,$list); | |
1044 | - $start_tag = ""; | |
1045 | - $end_tag = "</{$element}>"; | |
1041 | + $doc = $regs[2]; | |
1042 | + $doc = $this->my_wordwrap($doc); | |
1043 | + $doc = htmlspecialchars($doc); | |
1044 | + $doc = str_replace(array('/',"\t",'$','<'),array("/"," ",'$','&#lt'),$doc); | |
1045 | + $doc = str_replace("\n","</code><code>",$doc);//ワードラップは、改行だけ埋め込むので、タグを補充 | |
1046 | + $list = str_replace($regs[0],$start_tag.$start_content.trim($doc).$end_content,$list); | |
1047 | + $start_tag = ""; | |
1048 | + $end_tag = "</{$element}>"; | |
1046 | 1049 | |
1047 | 1050 | }elseif(!empty($end_tag)){ |
1048 | - | |
1049 | - $list = $end_tag."\n".$list; | |
1051 | + | |
1052 | + $list = $end_tag."\n".$list; | |
1050 | 1053 | $this->content_no++; |
1051 | - $end_tag = ''; | |
1052 | - $start_tag = "<{$element} $attr id=\"$element-$description-".trim($this->content_no)."\">"; | |
1053 | - $i = 0; | |
1054 | + $end_tag = ''; | |
1055 | + $start_tag = "<{$element} $attr id=\"$element-$description-".trim($this->content_no)."\">"; | |
1056 | + $i = 0; | |
1054 | 1057 | }else{ |
1055 | - | |
1056 | - $start_tag = "<{$element} $attr id=\"$element-$description-".trim($this->content_no)."\">"; | |
1057 | - $i =0; | |
1058 | + | |
1059 | + $start_tag = "<{$element} $attr id=\"$element-$description-".trim($this->content_no)."\">"; | |
1060 | + $i =0; | |
1058 | 1061 | } |
1059 | 1062 | |
1060 | 1063 | $result .= $list; |
@@ -1083,19 +1086,19 @@ | ||
1083 | 1086 | $description = $description.$content_name; |
1084 | 1087 | } |
1085 | 1088 | |
1086 | - $start_tag = "<{$element} $attr id=\"table-$description-".$this->content_no."\">"; | |
1087 | - $lines = explode($separator,$document); | |
1088 | - $group = "<colgroup><col /></colgroup>"; | |
1089 | + $start_tag = "<{$element} $attr id=\"table-$description-".$this->content_no."\">"; | |
1090 | + $lines = explode($separator,$document); | |
1091 | + $group = "<colgroup><col /></colgroup>"; | |
1089 | 1092 | |
1090 | 1093 | foreach($lines as $key=>$list){ |
1091 | 1094 | |
1092 | - $list = $list. $separator; | |
1093 | - $write_group = false; | |
1095 | + $list = $list. $separator; | |
1096 | + $write_group = false; | |
1094 | 1097 | |
1095 | 1098 | if(ereg("(^$wm{1})(.+)",$list,$regs)){ |
1096 | 1099 | |
1097 | 1100 | if(preg_match("/({$wm}summary:)(.+)/um",$list,$match)){ |
1098 | - | |
1101 | + | |
1099 | 1102 | if($end_tag){ |
1100 | 1103 | |
1101 | 1104 | $start_tag = "</table>\n<{$element} $attr summary=\"$match[2]\" id=\"table-$description-".$this->content_no."\">"; |
@@ -1105,9 +1108,9 @@ | ||
1105 | 1108 | $start_tag = "<{$element} $attr summary=\"$match[2]\" id=\"table-$description-".$this->content_no."\">"; |
1106 | 1109 | } |
1107 | 1110 | |
1108 | - $write_group = true; | |
1109 | - unset($regs[2]); | |
1110 | - $list = ""; | |
1111 | + $write_group = true; | |
1112 | + unset($regs[2]); | |
1113 | + $list = ""; | |
1111 | 1114 | |
1112 | 1115 | }else{ |
1113 | 1116 |
@@ -1116,20 +1119,20 @@ | ||
1116 | 1119 | if(isset($regs[2])){ |
1117 | 1120 | |
1118 | 1121 | $fields = explode('|',$regs[2]); |
1119 | - $col_no =1; | |
1122 | + $col_no =1; | |
1120 | 1123 | foreach($fields as $colkey=>$field){ |
1121 | - | |
1124 | + | |
1122 | 1125 | $ht_field .= "<td class=\"col{$col_no} row{$row_no}\" id=\"tbl".$this->content_no."{$col_no}{$row_no}\">$field</td>"; |
1123 | 1126 | $col_no++; |
1124 | 1127 | |
1125 | 1128 | } |
1126 | - | |
1129 | + | |
1127 | 1130 | $row_no++; |
1128 | 1131 | } |
1129 | 1132 | |
1130 | - $list = str_replace($regs[0],$start_tag."<$content>".$ht_field."</$content>\n",$list); | |
1131 | - $start_tag = ""; | |
1132 | - $end_tag = "</{$element}>\n"; | |
1133 | + $list = str_replace($regs[0],$start_tag."<$content>".$ht_field."</$content>\n",$list); | |
1134 | + $start_tag = ""; | |
1135 | + $end_tag = "</{$element}>\n"; | |
1133 | 1136 | |
1134 | 1137 | if(!isset($lines[$key + 1]) or !ereg("(^$wm{1})(.+)",$lines[$key + 1])){ |
1135 | 1138 |
@@ -1138,22 +1141,22 @@ | ||
1138 | 1141 | } |
1139 | 1142 | } |
1140 | 1143 | }elseif($end_tag){ |
1141 | - | |
1142 | - $list = $end_tag."\n".$list; | |
1143 | - $row_no = 1; | |
1144 | 1144 | |
1145 | + $list = $end_tag."\n".$list; | |
1146 | + $row_no = 1; | |
1147 | + | |
1145 | 1148 | $this->content_no++; |
1146 | 1149 | |
1147 | - $start_tag = "<{$element} $attr id=\"table-$description-".$this->content_no."\">"; | |
1148 | - $end_tag = false; | |
1150 | + $start_tag = "<{$element} $attr id=\"table-$description-".$this->content_no."\">"; | |
1151 | + $end_tag = false; | |
1149 | 1152 | }else{ |
1150 | - | |
1153 | + | |
1151 | 1154 | $start_tag = "<{$element} $attr id=\"table-$description-".$this->content_no."\">"; |
1152 | 1155 | } |
1153 | 1156 | |
1154 | 1157 | $result .= $list; |
1155 | 1158 | } |
1156 | - return $this->tag_clear($result); | |
1159 | + return $this->tag_clear($result); | |
1157 | 1160 | } |
1158 | 1161 | |
1159 | 1162 | function text2html_element($document, $separator = "\n",$element = "h2",$wm = '*',$content = 'span',$attr = '',$content_attr = '',$description = ''){ |
@@ -1161,16 +1164,16 @@ | ||
1161 | 1164 | global $content_name; |
1162 | 1165 | |
1163 | 1166 | if(!empty($content_name) and !empty($description)){ |
1164 | - $description = $description.'-'.$content_name; | |
1167 | + $description = $description.'-'.$content_name; | |
1165 | 1168 | }else{ |
1166 | - $description = $description.$content_name; | |
1169 | + $description = $description.$content_name; | |
1167 | 1170 | } |
1168 | 1171 | |
1169 | 1172 | $lines = explode($separator,$document); |
1170 | - $start = true; | |
1171 | - $end_tag = ''; | |
1172 | - $result = ""; | |
1173 | - $start_tag = "<{$element} $attr id=\"$element-$description-".$this->content_no."\" >"; | |
1173 | + $start = true; | |
1174 | + $end_tag = ''; | |
1175 | + $result = ""; | |
1176 | + $start_tag = "<{$element} $attr id=\"$element-$description-".$this->content_no."\" >"; | |
1174 | 1177 | $this->content_no = 1; |
1175 | 1178 | |
1176 | 1179 | foreach($lines as $key => $list){ |
@@ -1178,43 +1181,43 @@ | ||
1178 | 1181 | $list = $list. "\n"; |
1179 | 1182 | |
1180 | 1183 | if(preg_match("/(^$wm{1})(.+)/um",$list,$regs)){ |
1181 | - | |
1184 | + | |
1182 | 1185 | if(!empty($content)){ |
1183 | - | |
1186 | + | |
1184 | 1187 | $content_start = "<$content $content_attr >"; |
1185 | 1188 | $content_end = "</$content>"; |
1186 | 1189 | }else{ |
1187 | - | |
1190 | + | |
1188 | 1191 | $content_start = ""; |
1189 | 1192 | $content_end = ""; |
1190 | 1193 | } |
1191 | - | |
1192 | - $list = str_replace($regs[0],$start_tag.$content_start.$regs[2].$content_end,$list); | |
1193 | - $start_tag = ""; | |
1194 | - $end_tag = "</{$element}>\n"; | |
1195 | 1194 | |
1195 | + $list = str_replace($regs[0],$start_tag.$content_start.$regs[2].$content_end,$list); | |
1196 | + $start_tag = ""; | |
1197 | + $end_tag = "</{$element}>\n"; | |
1198 | + | |
1196 | 1199 | //見出しリスト |
1197 | 1200 | |
1198 | - if(ereg("h([1-6])",$element,$match)){ | |
1199 | - | |
1200 | - $list = str_replace("\n","",$list); | |
1201 | + if(ereg("h([1-6])",$element,$match)){ | |
1202 | + | |
1203 | + $list = str_replace("\n","",$list); | |
1201 | 1204 | array_push($this->header_info,array($key,trim($match[1]),"$element-$description-".$this->content_no,$regs[2])); |
1202 | 1205 | } |
1203 | 1206 | |
1204 | 1207 | }elseif(!empty($end_tag)){ |
1205 | - | |
1206 | - $list = $end_tag."\n".$list; | |
1208 | + | |
1209 | + $list = $end_tag."\n".$list; | |
1207 | 1210 | $this->content_no++; |
1208 | - $end_tag = ''; | |
1209 | - $start_tag = "<{$element} $attr id=\"$element-$description-".$this->content_no."\" >"; | |
1211 | + $end_tag = ''; | |
1212 | + $start_tag = "<{$element} $attr id=\"$element-$description-".$this->content_no."\" >"; | |
1210 | 1213 | }else{ |
1211 | - | |
1212 | - $start_tag = "<{$element} $attr id=\"$element-$description-".$this->content_no."\" >"; | |
1214 | + | |
1215 | + $start_tag = "<{$element} $attr id=\"$element-$description-".$this->content_no."\" >"; | |
1213 | 1216 | } |
1214 | - $result .= $list; | |
1217 | + $result .= $list; | |
1215 | 1218 | } |
1216 | 1219 | |
1217 | - return $this->tag_clear($result); | |
1220 | + return $this->tag_clear($result); | |
1218 | 1221 | } |
1219 | 1222 | |
1220 | 1223 | function paragraf($document, $separator = "\n\n",$element = "p",$wm = '',$content = '',$attr = '',$content_attr = '',$description = 'paragraph'){ |
@@ -1231,43 +1234,43 @@ | ||
1231 | 1234 | |
1232 | 1235 | foreach($checks as $val){ |
1233 | 1236 | |
1234 | - $check[] = "<$val"; | |
1235 | - $check[] = "$val>"; | |
1236 | - $check[] = "</$val"; | |
1237 | + $check[] = "<$val"; | |
1238 | + $check[] = "$val>"; | |
1239 | + $check[] = "</$val"; | |
1237 | 1240 | |
1238 | - $replace[] = "\n\n<$val"; | |
1239 | - $replace[] = "$val>$separator"; | |
1240 | - $replace[] = "$separator</$val"; | |
1241 | + $replace[] = "\n\n<$val"; | |
1242 | + $replace[] = "$val>$separator"; | |
1243 | + $replace[] = "$separator</$val"; | |
1241 | 1244 | } |
1242 | 1245 | |
1243 | 1246 | |
1244 | - $document = str_replace($check,$replace,$document); | |
1245 | - $document = $this->tag_clear($document); | |
1246 | - $document = ereg_replace("(\n{1})","\n\n",$document); | |
1247 | - $lines = explode($separator,$document); | |
1248 | - $start = true; | |
1249 | - $end_tag = ''; | |
1250 | - $result = ""; | |
1251 | - $this->content_no = 1; | |
1252 | - $start_tag = "<{$element} $attr id=\"$element-$description-".$this->content_no."\">"; | |
1253 | - //$wm = "[^(\*|+|<|\=|\n$|\s|code:| )]"; | |
1254 | - $blocks = true;//pをコンテンツに出来ないタグ内での変換を禁止 | |
1255 | - $wm = "[^(\*|\+|\=|\n$|\s| |\-|<)]"; | |
1256 | - $tags_block = "(dl|ol|ul|address|blockquote|form|fieldset|table|style|tr|p|code)"; | |
1257 | - $cdata_zone = false; | |
1247 | + $document = str_replace($check,$replace,$document); | |
1248 | + $document = $this->tag_clear($document); | |
1249 | + $document = ereg_replace("(\n{1})","\n\n",$document); | |
1250 | + $lines = explode($separator,$document); | |
1251 | + $start = true; | |
1252 | + $end_tag = ''; | |
1253 | + $result = ""; | |
1254 | + $this->content_no = 1; | |
1255 | + $start_tag = "<{$element} $attr id=\"$element-$description-".$this->content_no."\">"; | |
1256 | + //$wm = "[^(\*|+|<|\=|\n$|\s|code:| )]"; | |
1257 | + $blocks = true;//pをコンテンツに出来ないタグ内での変換を禁止 | |
1258 | + $wm = "[^(\*|\+|\=|\n$|\s| |\-|<)]"; | |
1259 | + $tags_block = "(dl|ol|ul|address|blockquote|form|fieldset|table|style|tr|p|code)"; | |
1260 | + $cdata_zone = false; | |
1258 | 1261 | |
1259 | 1262 | foreach($lines as $key => $list){ |
1260 | - | |
1263 | + | |
1261 | 1264 | $list = $list."\n\n"; |
1262 | 1265 | |
1263 | - if(preg_match("/(<!--|<!\[CDATA\[|<script|<style|<$tags_block)/iu",$list) and !preg_match("/(!--|\]\]>|\/script|\/style|<\/$tags_block)\s?\/?>/iu",$list)){ | |
1264 | - $cdata_zone = true; | |
1265 | - //テーブル間にタグを適用できなくなる | |
1266 | - } | |
1266 | + if(preg_match("/(<!--|<!\[CDATA\[|<script|<style|<$tags_block)/iu",$list) and !preg_match("/(!--|\]\]>|\/script|\/style|<\/$tags_block)\s?\/?>/iu",$list)){ | |
1267 | + $cdata_zone = true; | |
1268 | + //テーブル間にタグを適用できなくなる | |
1269 | + } | |
1267 | 1270 | |
1268 | - if(preg_match("/(^($wm).*)/um",$list,$regs) and $cdata_zone == false ){ | |
1271 | + if(preg_match("/(^($wm).*)/um",$list,$regs) and $cdata_zone == false ){ | |
1269 | 1272 | |
1270 | - $content_start = ""; | |
1273 | + $content_start = ""; | |
1271 | 1274 | |
1272 | 1275 | if(isset($lines[$key + 1]) and $lines[$key + 1] == true){ |
1273 | 1276 |
@@ -1277,19 +1280,19 @@ | ||
1277 | 1280 | $content_end = ""; |
1278 | 1281 | } |
1279 | 1282 | |
1280 | - $list = str_replace($regs[0],$start_tag.$content_start.trim($regs[1]).$content_end,$list); | |
1281 | - $start_tag = ""; | |
1282 | - $end_tag = "\n</{$element}>\n\n"; | |
1283 | - $paragraph_div = '¶'; | |
1284 | - | |
1285 | - if(eregi($paragraph_div,$list)){ | |
1286 | - | |
1287 | - $list = str_replace(array($paragraph_div.$content_end,$paragraph_div),$end_tag, $list); | |
1288 | - $end_tag = ''; | |
1289 | - $this->content_no++; | |
1290 | - $start_tag = "<{$element} $attr id=\"$element-$description-".$this->content_no."\">"; | |
1291 | - } | |
1283 | + $list = str_replace($regs[0],$start_tag.$content_start.trim($regs[1]).$content_end,$list); | |
1284 | + $start_tag = ""; | |
1285 | + $end_tag = "\n</{$element}>\n\n"; | |
1286 | + $paragraph_div = '¶'; | |
1292 | 1287 | |
1288 | + if(eregi($paragraph_div,$list)){ | |
1289 | + | |
1290 | + $list = str_replace(array($paragraph_div.$content_end,$paragraph_div),$end_tag, $list); | |
1291 | + $end_tag = ''; | |
1292 | + $this->content_no++; | |
1293 | + $start_tag = "<{$element} $attr id=\"$element-$description-".$this->content_no."\">"; | |
1294 | + } | |
1295 | + | |
1293 | 1296 | }elseif(!empty($end_tag) ){ |
1294 | 1297 | |
1295 | 1298 | $list = $end_tag."\n".$list; |
@@ -1316,8 +1319,8 @@ | ||
1316 | 1319 | |
1317 | 1320 | function img_copy($buffer){ |
1318 | 1321 | |
1319 | - if(!defined('TEXTTOHTML_IMAGE_DIR_PATH')){return $buffer;} | |
1320 | - | |
1322 | + if(!defined('TEXTTOHTML_IMAGE_DIR_PATH')){return $buffer;} | |
1323 | + | |
1321 | 1324 | $copy_width = TEXTTOHTML_COPY_IMG_WIDTH; |
1322 | 1325 | |
1323 | 1326 | if(preg_match_all("/(copy>\()([^\)]+)(\))/", $buffer, $matches, PREG_SET_ORDER)){ |
@@ -1324,20 +1327,20 @@ | ||
1324 | 1327 | |
1325 | 1328 | foreach($matches as $key=>$match){ |
1326 | 1329 | |
1327 | - $cache = use_cache($matches[$key][0],$buffer); | |
1330 | + $cache = use_cache($matches[$key][0],$buffer); | |
1328 | 1331 | |
1329 | 1332 | if($cache[0]){ |
1330 | 1333 | |
1331 | - $buffer= str_replace($matches[$key][0],$cache[1],$buffer)."\n"; | |
1334 | + $buffer= str_replace($matches[$key][0],$cache[1],$buffer)."\n"; | |
1332 | 1335 | }else{ |
1333 | 1336 | clearstatcache(); |
1334 | - | |
1335 | - $copy_target = TEXTTOHTML_IMAGE_DIR_PATH.basename($match[2]); | |
1336 | - $copy_target_url = TEXTTOHTML_IMAGE_DIR_URL.basename($match[2]); | |
1337 | - $quote_comment = "<!--from:".$match[2]."--><a href=\"".$match[2]."\" class=\"quoted\">"; | |
1338 | - $size = getimagesize($match[2]); | |
1339 | - $uri = htmlspecialchars(trim($match[2])); | |
1340 | 1337 | |
1338 | + $copy_target = TEXTTOHTML_IMAGE_DIR_PATH.basename($match[2]); | |
1339 | + $copy_target_url = TEXTTOHTML_IMAGE_DIR_URL.basename($match[2]); | |
1340 | + $quote_comment = "<!--from:".$match[2]."--><a href=\"".$match[2]."\" class=\"quoted\">"; | |
1341 | + $size = getimagesize($match[2]); | |
1342 | + $uri = htmlspecialchars(trim($match[2])); | |
1343 | + | |
1341 | 1344 | if($size[0] > $copy_width){ |
1342 | 1345 | $aspect = @round($size[1]/$size[0],2); |
1343 | 1346 | $height = @round($copy_width * $aspect,0); |
@@ -1345,42 +1348,42 @@ | ||
1345 | 1348 | $copy_width = $size[0]; |
1346 | 1349 | $height = $size[1]; |
1347 | 1350 | } |
1348 | - | |
1351 | + | |
1349 | 1352 | $gdimg = imagecreatetruecolor($copy_width,$height); |
1350 | 1353 | |
1351 | 1354 | if($size[2] == 1) { |
1352 | - | |
1353 | - if( $im = imagecreatefromgif($uri)){ | |
1354 | - imagecopyresized($gdimg,$im,0,0,0,0,$copy_width,$height,$size[0],$size[1]); | |
1355 | - @imagegif($gdimg,$copy_target); | |
1356 | - } | |
1355 | + | |
1356 | + if( $im = imagecreatefromgif($uri)){ | |
1357 | + imagecopyresized($gdimg,$im,0,0,0,0,$copy_width,$height,$size[0],$size[1]); | |
1358 | + @imagegif($gdimg,$copy_target); | |
1359 | + } | |
1357 | 1360 | } |
1358 | - | |
1361 | + | |
1359 | 1362 | if($size[2] == 2 and $size) { |
1360 | - | |
1361 | - if( $im = imagecreatefromjpeg($uri)){ | |
1362 | - imagecopyresized($gdimg,$im,0,0,0,0,$copy_width,$height,$size[0],$size[1]); | |
1363 | - @imagejpeg($gdimg,$copy_target); | |
1364 | - } | |
1363 | + | |
1364 | + if( $im = imagecreatefromjpeg($uri)){ | |
1365 | + imagecopyresized($gdimg,$im,0,0,0,0,$copy_width,$height,$size[0],$size[1]); | |
1366 | + @imagejpeg($gdimg,$copy_target); | |
1367 | + } | |
1365 | 1368 | } |
1366 | 1369 | if($size[2] == 3) { |
1367 | - | |
1368 | - if($im = imagecreatefrompng($uri)){ | |
1369 | - imagecopyresized($gdimg,$im,0,0,0,0,$copy_width,$height,$size[0],$size[1]); | |
1370 | - @imagepng($gdimg,$copy_target); | |
1371 | - } | |
1370 | + | |
1371 | + if($im = imagecreatefrompng($uri)){ | |
1372 | + imagecopyresized($gdimg,$im,0,0,0,0,$copy_width,$height,$size[0],$size[1]); | |
1373 | + @imagepng($gdimg,$copy_target); | |
1374 | + } | |
1372 | 1375 | } |
1373 | 1376 | if($size[2] == 15) { |
1374 | - | |
1375 | - if($im = imagecreatefromwbmp($uri)){ | |
1376 | - imagecopyresized($gdimg,$im,0,0,0,0,$copy_width,$height,$size[0],$size[1]); | |
1377 | - @imagebmp($gdimg,$copy_target); | |
1378 | - } | |
1377 | + | |
1378 | + if($im = imagecreatefromwbmp($uri)){ | |
1379 | + imagecopyresized($gdimg,$im,0,0,0,0,$copy_width,$height,$size[0],$size[1]); | |
1380 | + @imagebmp($gdimg,$copy_target); | |
1381 | + } | |
1379 | 1382 | } |
1380 | - | |
1381 | - $buffer= str_replace($matches[$key][0],$quote_comment."<img src=\"".$copy_target_url."\" width=\"$copy_width\" height=\"$height\" alt=\"copyed image\" /></a>",$buffer)."\n"; | |
1382 | - | |
1383 | 1383 | |
1384 | + $buffer= str_replace($matches[$key][0],$quote_comment."<img src=\"".$copy_target_url."\" width=\"$copy_width\" height=\"$height\" alt=\"copyed image\" /></a>",$buffer)."\n"; | |
1385 | + | |
1386 | + | |
1384 | 1387 | save_cache($matches[$key][0],$quote_comment."<img src=\"".$copy_target_url."\" width=\"$copy_width\" height=\"$height\" alt=\"copyed image\" /></a>"); |
1385 | 1388 | } |
1386 | 1389 |
@@ -1392,17 +1395,17 @@ | ||
1392 | 1395 | |
1393 | 1396 | function keyword_change($document){ |
1394 | 1397 | |
1395 | - $keyword_res = array(); | |
1396 | - $change_val_res = array(); | |
1398 | + $keyword_res = array(); | |
1399 | + $change_val_res = array(); | |
1397 | 1400 | |
1398 | 1401 | if(phpversion('domDocument')){ |
1399 | 1402 | |
1400 | - $dom = new domDocument; | |
1401 | - $dom->load(CHANGE_PATTERN_PATH); | |
1402 | - $root = $dom->documentElement; | |
1403 | - $books = $root->childNodes; | |
1404 | - $keyword_res = array(); | |
1405 | - $change_val = array(); | |
1403 | + $dom = new domDocument; | |
1404 | + $dom->load(CHANGE_PATTERN_PATH); | |
1405 | + $root = $dom->documentElement; | |
1406 | + $books = $root->childNodes; | |
1407 | + $keyword_res = array(); | |
1408 | + $change_val = array(); | |
1406 | 1409 | |
1407 | 1410 | foreach ($books as $book) { |
1408 | 1411 |
@@ -1425,8 +1428,8 @@ | ||
1425 | 1428 | |
1426 | 1429 | }else{ |
1427 | 1430 | |
1428 | - $data = file_get_contents(CHANGE_PATTERN_PATH); | |
1429 | - $dls = explode("<dl>",$data); | |
1431 | + $data = file_get_contents(CHANGE_PATTERN_PATH); | |
1432 | + $dls = explode("<dl>",$data); | |
1430 | 1433 | |
1431 | 1434 | foreach($dls as $dl){ |
1432 | 1435 |
@@ -1436,15 +1439,15 @@ | ||
1436 | 1439 | array_push($change_val_res,$change_val[2]); |
1437 | 1440 | } |
1438 | 1441 | |
1439 | - $keyword_res = str_replace(array(">","<","&","""),array(">","<",'&','"'),$keyword_res); | |
1440 | - $change_val_res = str_replace(array(">","<","&","""),array(">","<",'&','"'),$change_val_res); | |
1441 | - $res = str_replace($keyword_res,$change_val_res,$document); | |
1442 | + $keyword_res = str_replace(array(">","<","&","""),array(">","<",'&','"'),$keyword_res); | |
1443 | + $change_val_res = str_replace(array(">","<","&","""),array(">","<",'&','"'),$change_val_res); | |
1444 | + $res = str_replace($keyword_res,$change_val_res,$document); | |
1442 | 1445 | return $res; |
1443 | 1446 | } |
1444 | 1447 | } |
1445 | 1448 | |
1446 | 1449 | |
1447 | - function keyword_change_inline($document, $separator = "\n"){ | |
1450 | + function keyword_change_inline($document, $separator = "\n"){ | |
1448 | 1451 | |
1449 | 1452 | $before_start = "<!--%"; |
1450 | 1453 | $before_end = "%-->"; |
@@ -1464,9 +1467,9 @@ | ||
1464 | 1467 | |
1465 | 1468 | if($record == 0 and ereg("(^$start_tag)([^/]+)($end_tag)",$words,$keyword)){ |
1466 | 1469 | |
1467 | - $change = ""; | |
1468 | - $keyword = $before_start.$keyword[2].$before_end; | |
1469 | - $record = 1; | |
1470 | + $change = ""; | |
1471 | + $keyword = $before_start.$keyword[2].$before_end; | |
1472 | + $record = 1; | |
1470 | 1473 | }elseif($record == 1 and !ereg("(^$start_tag\/)(.+)($end_tag)",$words)){ |
1471 | 1474 | |
1472 | 1475 | $change .= $words . "\n"; |
@@ -1489,7 +1492,7 @@ | ||
1489 | 1492 | $document_result = str_replace($keyword_res,$change_val_res,$document_result); |
1490 | 1493 | $result = str_replace(array("<><>","><"),array("\n",">\n<"),$document_result); |
1491 | 1494 | |
1492 | - return $this->tag_clear($result); | |
1495 | + return $this->tag_clear($result); | |
1493 | 1496 | } |
1494 | 1497 | |
1495 | 1498 |
@@ -1500,17 +1503,17 @@ | ||
1500 | 1503 | if(preg_match_all("/(\[)($tags_inline)(\|)([^\|]+)(\|)([^\]]+)(\])/", $text, $matches, PREG_SET_ORDER)){ |
1501 | 1504 | foreach($matches as $key=>$match){ |
1502 | 1505 | |
1503 | - $element = mb_convert_encoding($match[2],"UTF-8","auto"); | |
1504 | - $attr = mb_convert_encoding($match[5],"UTF-8","auto"); | |
1505 | - $value = mb_convert_encoding($match[7],"UTF-8","auto"); | |
1506 | - $replacement = "<$element $attr>$value</$element>"; | |
1507 | - $text = str_replace($matches[$key][0],$replacement,$text)."\n"; | |
1506 | + $element = mb_convert_encoding($match[2],"UTF-8","auto"); | |
1507 | + $attr = mb_convert_encoding($match[5],"UTF-8","auto"); | |
1508 | + $value = mb_convert_encoding($match[7],"UTF-8","auto"); | |
1509 | + $replacement = "<$element $attr>$value</$element>"; | |
1510 | + $text = str_replace($matches[$key][0],$replacement,$text)."\n"; | |
1508 | 1511 | } |
1509 | - | |
1510 | - $code_hit = true; | |
1512 | + | |
1513 | + $code_hit = true; | |
1511 | 1514 | } |
1512 | - | |
1513 | - return $text; | |
1515 | + | |
1516 | + return $text; | |
1514 | 1517 | } |
1515 | 1518 | |
1516 | 1519 |
@@ -1517,69 +1520,69 @@ | ||
1517 | 1520 | function ruby($text){ |
1518 | 1521 | |
1519 | 1522 | if(preg_match_all("/(ruby>\()([^:]+)(:)([^\)]+)(\))/", $text, $matches, PREG_SET_ORDER)){ |
1520 | - | |
1523 | + | |
1521 | 1524 | foreach($matches as $key=>$match){ |
1522 | 1525 | |
1523 | - $word = mb_convert_encoding($match[2],"UTF-8","auto"); | |
1524 | - $kana = mb_convert_encoding($match[4],"UTF-8","auto"); | |
1525 | - $word = str_replace("\n","",$word); | |
1526 | - $kana = str_replace("\n","",$kana); | |
1527 | - $replacement = "<ruby><rb>$word</rb><rp>(</rp><rt>$kana</rt><rp>)</rp></ruby>"; | |
1528 | - $text = str_replace($matches[$key][0],$replacement,$text)."\n"; | |
1526 | + $word = mb_convert_encoding($match[2],"UTF-8","auto"); | |
1527 | + $kana = mb_convert_encoding($match[4],"UTF-8","auto"); | |
1528 | + $word = str_replace("\n","",$word); | |
1529 | + $kana = str_replace("\n","",$kana); | |
1530 | + $replacement = "<ruby><rb>$word</rb><rp>(</rp><rt>$kana</rt><rp>)</rp></ruby>"; | |
1531 | + $text = str_replace($matches[$key][0],$replacement,$text)."\n"; | |
1529 | 1532 | } |
1530 | 1533 | |
1531 | - $code_hit = true; | |
1534 | + $code_hit = true; | |
1532 | 1535 | } |
1533 | - | |
1534 | - return $text; | |
1536 | + | |
1537 | + return $text; | |
1535 | 1538 | } |
1536 | 1539 | |
1537 | 1540 | |
1538 | 1541 | function trackback($text){ |
1539 | 1542 | |
1540 | - if(!defined('TEXTTOHTML_TRACKBACK_URL')){return $text;} | |
1543 | + if(!defined('TEXTTOHTML_TRACKBACK_URL')){return $text;} | |
1541 | 1544 | |
1542 | 1545 | if(preg_match_all("/(trackback>\()([^\)]+)(\))/", $text, $matches, PREG_SET_ORDER)){ |
1543 | - | |
1546 | + | |
1544 | 1547 | foreach($matches as $key=>$match){ |
1545 | - | |
1546 | - $tabindex = $key + 1; | |
1547 | 1548 | |
1548 | - switch ($key) { | |
1549 | - case 0: | |
1550 | - $accesskey = "a"; | |
1551 | - break; | |
1552 | - case 1: | |
1553 | - $accesskey = "b"; | |
1554 | - break; | |
1555 | - case 2: | |
1556 | - $accesskey = "c"; | |
1557 | - break; | |
1558 | - case 3: | |
1559 | - $accesskey = "d"; | |
1560 | - break; | |
1561 | - case 4: | |
1562 | - $accesskey = "e"; | |
1563 | - break; | |
1564 | - case 5: | |
1565 | - $accesskey = "f"; | |
1566 | - break; | |
1567 | - default: | |
1568 | - $accesskey = "g"; | |
1569 | - | |
1570 | - } | |
1549 | + $tabindex = $key + 1; | |
1571 | 1550 | |
1572 | - $enc = mb_convert_encoding($match[2],"UTF-8","auto"); | |
1573 | - $enc = urlencode($enc); | |
1574 | - | |
1551 | + switch ($key) { | |
1552 | + case 0: | |
1553 | + $accesskey = "a"; | |
1554 | + break; | |
1555 | + case 1: | |
1556 | + $accesskey = "b"; | |
1557 | + break; | |
1558 | + case 2: | |
1559 | + $accesskey = "c"; | |
1560 | + break; | |
1561 | + case 3: | |
1562 | + $accesskey = "d"; | |
1563 | + break; | |
1564 | + case 4: | |
1565 | + $accesskey = "e"; | |
1566 | + break; | |
1567 | + case 5: | |
1568 | + $accesskey = "f"; | |
1569 | + break; | |
1570 | + default: | |
1571 | + $accesskey = "g"; | |
1572 | + | |
1573 | + } | |
1574 | + | |
1575 | + $enc = mb_convert_encoding($match[2],"UTF-8","auto"); | |
1576 | + $enc = urlencode($enc); | |
1577 | + | |
1575 | 1578 | $replacement = "<div class=\"trackback\"><span>トラックバック:".$match[2]."</span><br />Track back URL:<input type=\"text\" value=\"".TEXTTOHTML_TRACKBACK_URL. $enc. "\" accesskey=\"$accesskey\" tabindex=\"".$tabindex."\" /><br /><script type=\"text/javascript\" src=\"".TEXTTOHTML_TRACKBACK_URL. $enc. "\"></script>\n</div>\n"; |
1576 | 1579 | |
1577 | - $text = str_replace($matches[$key][0],$replacement,$text)."\n"; | |
1580 | + $text = str_replace($matches[$key][0],$replacement,$text)."\n"; | |
1578 | 1581 | } |
1579 | 1582 | |
1580 | 1583 | $code_hit = true; |
1581 | 1584 | } |
1582 | - return $text; | |
1585 | + return $text; | |
1583 | 1586 | |
1584 | 1587 | } |
1585 | 1588 | /*------------------------------------------------------------------------------+ |
@@ -1600,8 +1603,8 @@ | ||
1600 | 1603 | } |
1601 | 1604 | |
1602 | 1605 | } |
1603 | - | |
1604 | - return $text; | |
1606 | + | |
1607 | + return $text; | |
1605 | 1608 | } |
1606 | 1609 | |
1607 | 1610 |
@@ -1632,8 +1635,8 @@ | ||
1632 | 1635 | $text= str_replace($matches[$key][0],$quote_comment."{$copy_target}?w={$copy_width}h={$height}alt=YouTube </a>",$text)."\n"; |
1633 | 1636 | } |
1634 | 1637 | } |
1635 | - | |
1636 | - return $text; | |
1638 | + | |
1639 | + return $text; | |
1637 | 1640 | } |
1638 | 1641 | /*------------------------------------------------------------------------------+ |
1639 | 1642 | * 文字列から、イメージの作成とコーディング処理 |
@@ -1640,41 +1643,41 @@ | ||
1640 | 1643 | *------------------------------------------------------------------------------*/ |
1641 | 1644 | function txt2img($buffer,$separator = "\n"){ |
1642 | 1645 | |
1643 | - global $default; | |
1644 | - | |
1645 | - if(!defined('TEXTTOHTML_FONTS_PATH') ){return $buffer;}else{ | |
1646 | + global $default; | |
1646 | 1647 | |
1647 | - include(TEXTTOHTML_FONTS_PATH); | |
1648 | - $buffers = explode($separator,$buffer); | |
1649 | - $string = ""; | |
1650 | - | |
1651 | - foreach($buffers as $buffer){ | |
1652 | - | |
1653 | - if(preg_match_all("/(txt2img>\()([^\)]+)(\))/", $buffer, $matches, PREG_SET_ORDER)){ | |
1654 | - | |
1655 | - foreach($matches as $key=>$match){ | |
1656 | - | |
1657 | - if(ereg("(:)",$match[2])){ | |
1658 | - list($element,$val_name,$val) =explode(":",$match[2]); | |
1659 | - | |
1660 | - $replacement = $this->convert_image($val,$$val_name,$element); | |
1661 | - }else{ | |
1662 | - $replacement = $this->convert_image($match[2],$default,"p"); | |
1663 | - } | |
1664 | - | |
1665 | - $string .= str_replace($matches[$key][0],$replacement,$buffer); | |
1666 | - } | |
1667 | - | |
1668 | - | |
1669 | - }else{ | |
1670 | - | |
1671 | - $string .= $buffer."\n"; | |
1672 | - } | |
1673 | - } | |
1648 | + if(!defined('TEXTTOHTML_FONTS_PATH') ){return $buffer;}else{ | |
1674 | 1649 | |
1650 | + include(TEXTTOHTML_FONTS_PATH); | |
1651 | + $buffers = explode($separator,$buffer); | |
1652 | + $string = ""; | |
1653 | + | |
1654 | + foreach($buffers as $buffer){ | |
1655 | + | |
1656 | + if(preg_match_all("/(txt2img>\()([^\)]+)(\))/", $buffer, $matches, PREG_SET_ORDER)){ | |
1657 | + | |
1658 | + foreach($matches as $key=>$match){ | |
1659 | + | |
1660 | + if(ereg("(:)",$match[2])){ | |
1661 | + list($element,$val_name,$val) =explode(":",$match[2]); | |
1662 | + | |
1663 | + $replacement = $this->convert_image($val,$$val_name,$element); | |
1664 | + }else{ | |
1665 | + $replacement = $this->convert_image($match[2],$default,"p"); | |
1666 | + } | |
1667 | + | |
1668 | + $string .= str_replace($matches[$key][0],$replacement,$buffer); | |
1669 | + } | |
1670 | + | |
1671 | + | |
1672 | + }else{ | |
1673 | + | |
1674 | + $string .= $buffer."\n"; | |
1675 | + } | |
1676 | + } | |
1677 | + | |
1675 | 1678 | return $string; |
1676 | 1679 | |
1677 | - } | |
1680 | + } | |
1678 | 1681 | } |
1679 | 1682 | |
1680 | 1683 | ///////////////////////////////////////////////////////////// |
@@ -1681,16 +1684,16 @@ | ||
1681 | 1684 | |
1682 | 1685 | function convert_image( $string , $gd_set = array("gt200001","13","class=\"text2image\"","0"),$element = "p"){ |
1683 | 1686 | |
1684 | - if(!defined('TEXTTOHTML_IMAGE_DIR_URL')){return $string;} | |
1687 | + if(!defined('TEXTTOHTML_IMAGE_DIR_URL')){return $string;} | |
1685 | 1688 | |
1686 | - $file_name = md5($string.$gd_set[0].$gd_set[1]); | |
1687 | - $image_file_name = str_replace(array('=','"','\\'),array(""),$gd_set[1])."-".$file_name.'.png'; | |
1688 | - $image_file_name = TEXTTOHTML_IMAGE_DIR_URL.$image_file_name; | |
1689 | - $image_file_path = TEXTTOHTML_IMAGE_DIR_PATH.str_replace(array('=','"','\\'),array(""),$gd_set[1])."-".$file_name.'.png'; | |
1690 | - $cache = use_cache($file_name); | |
1689 | + $file_name = md5($string.$gd_set[0].$gd_set[1]); | |
1690 | + $image_file_name = str_replace(array('=','"','\\'),array(""),$gd_set[1])."-".$file_name.'.png'; | |
1691 | + $image_file_name = TEXTTOHTML_IMAGE_DIR_URL.$image_file_name; | |
1692 | + $image_file_path = TEXTTOHTML_IMAGE_DIR_PATH.str_replace(array('=','"','\\'),array(""),$gd_set[1])."-".$file_name.'.png'; | |
1693 | + $cache = use_cache($file_name); | |
1691 | 1694 | |
1692 | 1695 | if($cache[0]){ |
1693 | - | |
1696 | + | |
1694 | 1697 | $result= $cache[1]."\n"; |
1695 | 1698 | return $result; |
1696 | 1699 | }else{ |
@@ -1707,41 +1710,41 @@ | ||
1707 | 1710 | |
1708 | 1711 | switch(true){ |
1709 | 1712 | |
1710 | - case($background_img == "0"): //背景画像を使用しない | |
1711 | - | |
1712 | - $timg = imagecreate($fontsize * 2 * $len, $fontsize * 2); | |
1713 | - $background = ImageColorAllocate($timg, 255, 255, 255); | |
1714 | - ImageFill($timg, 0, 0, $background); | |
1715 | - $Color = ImageColorAllocate($timg, 0, 0, 0); | |
1716 | - break; | |
1717 | - | |
1718 | - default://背景画像を使用する。 | |
1719 | - | |
1720 | - $timg = imagecreatefrompng(TEXTTOHTML_FONT_DIR_PATH.$background_img); | |
1721 | - | |
1722 | - $Color = ImageColorAllocate($timg, 0, 0, 0); | |
1723 | - break; | |
1713 | + case($background_img == "0"): //背景画像を使用しない | |
1714 | + | |
1715 | + $timg = imagecreate($fontsize * 2 * $len, $fontsize * 2); | |
1716 | + $background = ImageColorAllocate($timg, 255, 255, 255); | |
1717 | + ImageFill($timg, 0, 0, $background); | |
1718 | + $Color = ImageColorAllocate($timg, 0, 0, 0); | |
1719 | + break; | |
1720 | + | |
1721 | + default://背景画像を使用する。 | |
1722 | + | |
1723 | + $timg = imagecreatefrompng(TEXTTOHTML_FONT_DIR_PATH.$background_img); | |
1724 | + | |
1725 | + $Color = ImageColorAllocate($timg, 0, 0, 0); | |
1726 | + break; | |
1724 | 1727 | } |
1725 | 1728 | |
1726 | 1729 | $vertical_align = $fontsize * 1.5; |
1727 | - $chr = mb_convert_encoding($string,"UTF-8","auto"); | |
1728 | - $box = ImageTTFText($timg, $fontsize, 0, $indent, $vertical_align, $Color, $font, $chr); | |
1729 | - $width = $box[2] + $marginRight; | |
1730 | - $timg_resized = ImageCreate($width, $fontsize * 2); | |
1731 | - | |
1730 | + $chr = mb_convert_encoding($string,"UTF-8","auto"); | |
1731 | + $box = ImageTTFText($timg, $fontsize, 0, $indent, $vertical_align, $Color, $font, $chr); | |
1732 | + $width = $box[2] + $marginRight; | |
1733 | + $timg_resized = ImageCreate($width, $fontsize * 2); | |
1734 | + | |
1732 | 1735 | imagecopy($timg_resized, $timg, 0, 0, 0, 0, $width, $fontsize * 2); |
1733 | 1736 | imagepng($timg_resized,$image_file_path); |
1734 | 1737 | |
1735 | 1738 | if($timg_resized){ |
1736 | 1739 | |
1737 | - $result = "<{$element} $attribute style=\"height:{$height}px;width:{$width}px;background:url($image_file_name);background-repeat:no-repeat;\">\n\t<span style=\"display:none;font-size:{$fontsize}px;\">$string</span></{$element}>\n"; | |
1740 | + $result = "<{$element} $attribute style=\"height:{$height}px;width:{$width}px;background:url($image_file_name);background-repeat:no-repeat;\">\n\t<span style=\"display:none;font-size:{$fontsize}px;\">$string</span></{$element}>\n"; | |
1738 | 1741 | |
1739 | - save_cache($file_name,$result); | |
1742 | + save_cache($file_name,$result); | |
1740 | 1743 | |
1741 | - return $result; | |
1744 | + return $result; | |
1742 | 1745 | }else{ |
1743 | - | |
1744 | - return $string; | |
1746 | + | |
1747 | + return $string; | |
1745 | 1748 | } |
1746 | 1749 | |
1747 | 1750 | } |
@@ -1795,16 +1798,16 @@ | ||
1795 | 1798 | function encode_query($text){ |
1796 | 1799 | |
1797 | 1800 | if(preg_match_all("/(query>\()([^\)]+)(\))/", $text, $matches, PREG_SET_ORDER)){ |
1798 | - | |
1801 | + | |
1799 | 1802 | foreach($matches as $key=>$match){ |
1800 | 1803 | |
1801 | - $enc = mb_convert_encoding($match[2],"UTF-8","auto"); | |
1802 | - $enc = urlencode($enc); | |
1803 | - $text= str_replace($matches[$key][0],$enc,$text)."\n"; | |
1804 | + $enc = mb_convert_encoding($match[2],"UTF-8","auto"); | |
1805 | + $enc = urlencode($enc); | |
1806 | + $text= str_replace($matches[$key][0],$enc,$text)."\n"; | |
1804 | 1807 | } |
1805 | 1808 | |
1806 | 1809 | } |
1807 | - return $text; | |
1810 | + return $text; | |
1808 | 1811 | } |
1809 | 1812 | |
1810 | 1813 | /*------------------------------------------------------------------------------+ |
@@ -1813,7 +1816,7 @@ | ||
1813 | 1816 | |
1814 | 1817 | function image($text){ |
1815 | 1818 | |
1816 | - $allow_img_filetype = "(\.gif|\.png|\.jpe?g)"; | |
1819 | + $allow_img_filetype = "(\.gif|\.png|\.jpe?g)"; | |
1817 | 1820 | |
1818 | 1821 | $text = eregi_replace("(https?://[[:alnum:]\+\$\;\?\.%,!#~*/:@&=_-]+)($allow_img_filetype)(\?w=)([0-9]{1,3})(h=)([0-9]{1,3})(alt=)?([^([:space:]|<)]+)?", "<img src=\"\\1\\2\" width=\"\\5\" height=\"\\7\" class=\"picture\" alt=\"\\9\" />",$text); |
1819 | 1822 |
@@ -1827,65 +1830,65 @@ | ||
1827 | 1830 | if(preg_match_all("/(https?)(:\/\/[[:alnum:]\+\$\;\?\.%,!#~*\/:@&=_-]+)(\()(b:|t:|s:)?([^\)]+)(\))/", $text, $matches, PREG_SET_ORDER)){ |
1828 | 1831 | |
1829 | 1832 | foreach($matches as $key=>$match){ |
1830 | - | |
1833 | + | |
1831 | 1834 | $cache = use_cache($matches[$key][0],$text); |
1832 | - | |
1833 | - if($cache[0]){ | |
1834 | - | |
1835 | - $text = str_replace($matches[$key][0],$cache[1],$text)."\n"; | |
1836 | - }else{ | |
1837 | 1835 | |
1838 | - switch($match[4]){ | |
1839 | - case('b:'): | |
1840 | - $attr = '_blank'; | |
1841 | - break; | |
1842 | - case('t:'): | |
1843 | - $attr = '_top'; | |
1844 | - break; | |
1845 | - case('s:'): | |
1846 | - $attr = '_self'; | |
1847 | - break; | |
1848 | - | |
1849 | - default: | |
1850 | - $attr = '_self'; | |
1851 | - | |
1852 | - break; | |
1853 | - } | |
1854 | - | |
1855 | - $attr = "onclick=\"this.target='$attr';\" onkeypress=\"this.target='$attr';\""; | |
1856 | - $link_name = mb_convert_encoding($match[5],"UTF-8","auto"); | |
1857 | - $url = $match[1].$match[2]; | |
1858 | - | |
1859 | - if(trim($link_name) == 'title'){ | |
1860 | - | |
1861 | - $cache = use_cache($matches[$key][0],$link_name); | |
1836 | + if($cache[0]){ | |
1862 | 1837 | |
1863 | - try{ | |
1864 | - if(!$data = mb_convert_encoding(file_get_contents($url),"UTF-8","auto")){ | |
1838 | + $text = str_replace($matches[$key][0],$cache[1],$text)."\n"; | |
1839 | + }else{ | |
1865 | 1840 | |
1866 | - throw new Exception('リンクタイトルを取得できません'); | |
1867 | - } | |
1841 | + switch($match[4]){ | |
1842 | + case('b:'): | |
1843 | + $attr = '_blank'; | |
1844 | + break; | |
1845 | + case('t:'): | |
1846 | + $attr = '_top'; | |
1847 | + break; | |
1848 | + case('s:'): | |
1849 | + $attr = '_self'; | |
1850 | + break; | |
1868 | 1851 | |
1869 | - preg_match( "/<title.*?>(.*?)<\/title>/si", $data, $regs ); | |
1870 | - $linkname = trim(strip_tags($regs[1])); | |
1871 | - $link_name = htmlspecialchars($linkname); | |
1872 | - | |
1873 | - }catch (Exception $e) { | |
1874 | - $link_name = $url; | |
1875 | - echo '例外: ',$url, $e->getMessage(), "\n"; | |
1876 | - } | |
1877 | - | |
1878 | - if(empty($link_name)){ $link_name = $url;} | |
1879 | - } | |
1880 | - | |
1881 | - $link = "<a href=\"".$url."\" $attr >".$link_name."</a>"; | |
1882 | - $text = str_replace($matches[$key][0],$link,$text)."\n"; | |
1883 | - } | |
1884 | - | |
1885 | - } | |
1886 | - | |
1887 | - } | |
1852 | + default: | |
1853 | + $attr = '_self'; | |
1888 | 1854 | |
1855 | + break; | |
1856 | + } | |
1857 | + | |
1858 | + $attr = "onclick=\"this.target='$attr';\" onkeypress=\"this.target='$attr';\""; | |
1859 | + $link_name = mb_convert_encoding($match[5],"UTF-8","auto"); | |
1860 | + $url = $match[1].$match[2]; | |
1861 | + | |
1862 | + if(trim($link_name) == 'title'){ | |
1863 | + | |
1864 | + $cache = use_cache($matches[$key][0],$link_name); | |
1865 | + | |
1866 | + try{ | |
1867 | + if(!$data = mb_convert_encoding(file_get_contents($url),"UTF-8","auto")){ | |
1868 | + | |
1869 | + throw new Exception('リンクタイトルを取得できません'); | |
1870 | + } | |
1871 | + | |
1872 | + preg_match( "/<title.*?>(.*?)<\/title>/si", $data, $regs ); | |
1873 | + $linkname = trim(strip_tags($regs[1])); | |
1874 | + $link_name = htmlspecialchars($linkname); | |
1875 | + | |
1876 | + }catch (Exception $e) { | |
1877 | + $link_name = $url; | |
1878 | + echo '例外: ',$url, $e->getMessage(), "\n"; | |
1879 | + } | |
1880 | + | |
1881 | + if(empty($link_name)){ $link_name = $url;} | |
1882 | + } | |
1883 | + | |
1884 | + $link = "<a href=\"".$url."\" $attr >".$link_name."</a>"; | |
1885 | + $text = str_replace($matches[$key][0],$link,$text)."\n"; | |
1886 | + } | |
1887 | + | |
1888 | + } | |
1889 | + | |
1890 | + } | |
1891 | + | |
1889 | 1892 | return $text; |
1890 | 1893 | } |
1891 | 1894 |
@@ -1892,8 +1895,8 @@ | ||
1892 | 1895 | |
1893 | 1896 | function name_link($text){ |
1894 | 1897 | |
1895 | - $text = eregi_replace("(link>)(https?)(://[[:alnum:]\+\$\;\?\.%,!#~*/:@&=_-]+)", "<a href=\"\\2\\3\" title=\"\\2\\3\">\\2\\3</a>\n", $text); | |
1896 | - $text = mb_ereg_replace("(https?)(://[[:alnum:]\+\$\;\?\.%,!#~*/:@&=_-]+)(()([^)]+)())", "<a href=\"\\1\\2\" title=\"\\1\\2\">\\4</a>\n",$text); | |
1898 | + $text = eregi_replace("(link>)(https?)(://[[:alnum:]\+\$\;\?\.%,!#~*/:@&=_-]+)", "<a href=\"\\2\\3\" title=\"\\2\\3\">\\2\\3</a>\n", $text); | |
1899 | + $text = mb_ereg_replace("(https?)(://[[:alnum:]\+\$\;\?\.%,!#~*/:@&=_-]+)(()([^)]+)())", "<a href=\"\\1\\2\" title=\"\\1\\2\">\\4</a>\n",$text); | |
1897 | 1900 | |
1898 | 1901 | return $text; |
1899 | 1902 | } |
@@ -1913,9 +1916,9 @@ | ||
1913 | 1916 | if(preg_match_all("/(eval>\[)([^\]]+)(\])/", $text, $matches, PREG_SET_ORDER)){ |
1914 | 1917 | foreach($matches as $key=>$match){ |
1915 | 1918 | |
1916 | - $str = mb_convert_encoding($match[2],"UTF-8","auto"); | |
1917 | - eval("\$str = $str;"); | |
1918 | - $text= str_replace($matches[$key][0],$str,$text)."\n"; | |
1919 | + $str = mb_convert_encoding($match[2],"UTF-8","auto"); | |
1920 | + eval("\$str = $str;"); | |
1921 | + $text= str_replace($matches[$key][0],$str,$text)."\n"; | |
1919 | 1922 | } |
1920 | 1923 | |
1921 | 1924 | } |
@@ -1975,18 +1978,18 @@ | ||
1975 | 1978 | if(preg_match_all("/(《)([^》]+)(》)/su", $text, $matches, PREG_SET_ORDER)){ |
1976 | 1979 | |
1977 | 1980 | foreach($matches as $key=>$match){ |
1978 | - | |
1979 | - $enc = mb_convert_encoding($match[2],"UTF-8","auto"); | |
1980 | - $replacement = "<a class=\"foot-note\" href=\"#foot-note-$key\" name=\"anchor-foot-note-$key\" id=\"anchor-foot-note-$key\" title=\"脚注へ移動\">[$key]</a>"; | |
1981 | - $text = str_replace($matches[$key][0],$replacement,$text)."\n"; | |
1982 | 1981 | |
1983 | - array_push($this->footNote, array($key,"anchor-foot-note-$key","foot-note-$key",$enc)); | |
1982 | + $enc = mb_convert_encoding($match[2],"UTF-8","auto"); | |
1983 | + $replacement = "<a class=\"foot-note\" href=\"#foot-note-$key\" name=\"anchor-foot-note-$key\" id=\"anchor-foot-note-$key\" title=\"脚注へ移動\">[$key]</a>"; | |
1984 | + $text = str_replace($matches[$key][0],$replacement,$text)."\n"; | |
1985 | + | |
1986 | + array_push($this->footNote, array($key,"anchor-foot-note-$key","foot-note-$key",$enc)); | |
1984 | 1987 | } |
1985 | 1988 | |
1986 | - $code_hit = true; | |
1989 | + $code_hit = true; | |
1987 | 1990 | } |
1988 | 1991 | |
1989 | - return $text; | |
1992 | + return $text; | |
1990 | 1993 | } |
1991 | 1994 | |
1992 | 1995 | /*------------------------------------------------------------------------------+ |
@@ -2031,13 +2034,13 @@ | ||
2031 | 2034 | -------------------------------------------------------------*/ |
2032 | 2035 | |
2033 | 2036 | function basic_cleaner($buffer,$separator = "\n"){ |
2034 | - | |
2035 | - global $parm; | |
2036 | - | |
2037 | + | |
2038 | + global $parm; | |
2039 | + | |
2037 | 2040 | $buffer = mb_convert_encoding($buffer,"UTF-8","auto"); |
2038 | - $file = explode($separator,$buffer); | |
2039 | - $text = ""; | |
2040 | - | |
2041 | + $file = explode($separator,$buffer); | |
2042 | + $text = ""; | |
2043 | + | |
2041 | 2044 | foreach($file as $key => $chk){ |
2042 | 2045 | |
2043 | 2046 | $chk = str_replace("\0", "", $chk); |
@@ -2049,8 +2052,8 @@ | ||
2049 | 2052 | $text .= "\n$chk"; |
2050 | 2053 | |
2051 | 2054 | } |
2052 | - | |
2053 | - return $text; | |
2055 | + | |
2056 | + return $text; | |
2054 | 2057 | } |
2055 | 2058 | /*------------------------------------------------------------------------------+ |
2056 | 2059 | * イメージサイズの検出 |
@@ -2059,9 +2062,9 @@ | ||
2059 | 2062 | |
2060 | 2063 | if(eregi("\.(gif|jpg|png|swc|psd|tiff|bmp|iff|jp2|jpx|jb2|jpc|xbm|wbmp)",$file)){ |
2061 | 2064 | list($width, $height, $type, $attr) = getimagesize($file); |
2062 | - return $attr; | |
2065 | + return $attr; | |
2063 | 2066 | }else{ |
2064 | - return $wide; | |
2067 | + return $wide; | |
2065 | 2068 | } |
2066 | 2069 | } |
2067 | 2070 |
@@ -2104,59 +2107,59 @@ | ||
2104 | 2107 | *------------------------------------------------------------------------------*/ |
2105 | 2108 | function style_set($str){ |
2106 | 2109 | |
2107 | - $tab = " "; | |
2108 | - $i = 0; | |
2109 | - $break = ""; | |
2110 | - $str = str_replace("<","@@@@@<",$str); | |
2110 | + $tab = " "; | |
2111 | + $i = 0; | |
2112 | + $break = ""; | |
2113 | + $str = str_replace("<","@@@@@<",$str); | |
2111 | 2114 | $result =""; |
2112 | - $lines = explode("@@@@@",$str); | |
2115 | + $lines = explode("@@@@@",$str); | |
2113 | 2116 | |
2114 | - foreach($lines as $key=>$line){ | |
2117 | + foreach($lines as $key=>$line){ | |
2115 | 2118 | |
2116 | 2119 | if(preg_match("/(<\/?(xml|html|body))/mi",$line) ){ |
2117 | 2120 | |
2118 | - $i = 0; | |
2119 | - $space = str_repeat($tab,$i); | |
2120 | - $break = "<br />\n"; | |
2121 | + $i = 0; | |
2122 | + $space = str_repeat($tab,$i); | |
2123 | + $break = "<br />\n"; | |
2121 | 2124 | |
2122 | 2125 | }elseif(preg_match("/(<\/?(xml|html|head|body|script|!doctype))/mi",$line) ){ |
2123 | 2126 | |
2124 | - $i = 2; | |
2125 | - $space = str_repeat($tab,$i); | |
2126 | - $break = "<br />\n"; | |
2127 | + $i = 2; | |
2128 | + $space = str_repeat($tab,$i); | |
2129 | + $break = "<br />\n"; | |
2127 | 2130 | }elseif(preg_match("/(<\/)/",$line) ){ |
2128 | 2131 | |
2129 | 2132 | if($i<0){ |
2130 | - $i = 0; | |
2131 | - } | |
2132 | - | |
2133 | - $space = str_repeat($tab,$i); | |
2134 | - $break = "<br />\n"; | |
2135 | - $i--; | |
2133 | + $i = 0; | |
2134 | + } | |
2135 | + | |
2136 | + $space = str_repeat($tab,$i); | |
2137 | + $break = "<br />\n"; | |
2138 | + $i--; | |
2136 | 2139 | }elseif(preg_match("/(\/>?)/",$line) ){ |
2137 | 2140 | |
2138 | 2141 | if($i<0){ |
2139 | - $i = 0; | |
2140 | - } | |
2141 | - | |
2142 | - $space = str_repeat($tab,$i); | |
2143 | - $break = "<br />\n"; | |
2142 | + $i = 0; | |
2143 | + } | |
2144 | + | |
2145 | + $space = str_repeat($tab,$i); | |
2146 | + $break = "<br />\n"; | |
2144 | 2147 | }else{ |
2145 | - $break = "<br />\n"; | |
2148 | + $break = "<br />\n"; | |
2146 | 2149 | |
2147 | 2150 | if($i<0){ |
2148 | - $i = 0; | |
2149 | - } | |
2150 | - | |
2151 | - $space = str_repeat($tab,$i); | |
2151 | + $i = 0; | |
2152 | + } | |
2153 | + | |
2154 | + $space = str_repeat($tab,$i); | |
2152 | 2155 | $i++; |
2153 | 2156 | |
2154 | 2157 | } |
2155 | 2158 | |
2156 | - $result .= $space.htmlspecialchars($line).$break; | |
2159 | + $result .= $space.htmlspecialchars($line).$break; | |
2157 | 2160 | } |
2158 | 2161 | |
2159 | - return $this->tag_clear($result); | |
2162 | + return $this->tag_clear($result); | |
2160 | 2163 | } |
2161 | 2164 | |
2162 | 2165 | /* ------------------------------------------------------------ |
@@ -2173,7 +2176,7 @@ | ||
2173 | 2176 | $text = str_replace("\r","\n",$text); |
2174 | 2177 | $text = preg_replace("/(\n){2,}/","\n\n",$text); |
2175 | 2178 | |
2176 | - return $text; | |
2179 | + return $text; | |
2177 | 2180 | } |
2178 | 2181 | |
2179 | 2182 | //end class |
@@ -2246,14 +2249,14 @@ | ||
2246 | 2249 | //wikipedia |
2247 | 2250 | function simpleapi_wikipedia($replacement, $count = 1){ |
2248 | 2251 | |
2249 | - $result = unserialize($replacement); | |
2250 | - $results = "<div style=\"margin:1em;\">"; | |
2252 | + $result = unserialize($replacement); | |
2253 | + $results = "<div style=\"margin:1em;\">"; | |
2251 | 2254 | |
2252 | 2255 | for($i=0;$i<$count;$i++){ |
2253 | - | |
2254 | - $title = $result[$i]['title']; | |
2255 | - $body = $result[$i]['body']; | |
2256 | - $results .= "<strong>Wikipedia:{$title}</strong><blockquote>".nl2br($body)."</blockquote>"; | |
2256 | + | |
2257 | + $title = $result[$i]['title']; | |
2258 | + $body = $result[$i]['body']; | |
2259 | + $results .= "<strong>Wikipedia:{$title}</strong><blockquote>".nl2br($body)."</blockquote>"; | |
2257 | 2260 | } |
2258 | 2261 | |
2259 | 2262 | return str_replace(array("<br>","<br/>"),"<br />",$results)."\n</div>"; |
@@ -2270,32 +2273,32 @@ | ||
2270 | 2273 | //////////////////////////////////////////////////////////////////////////////////// |
2271 | 2274 | function use_cache($name){ |
2272 | 2275 | |
2273 | - if(!defined('CACHE_LITE_PATH')){return array(false,"");} | |
2274 | - | |
2276 | + if(!defined('CACHE_LITE_PATH')){return array(false,"");} | |
2277 | + | |
2275 | 2278 | require_once(CACHE_LITE_PATH); |
2276 | 2279 | |
2277 | - $options = array( | |
2278 | - 'cacheDir' => CACHE_DIR_PATH, | |
2279 | - 'lifeTime' => CACHE_LIFE_TIME, | |
2280 | - ); | |
2280 | + $options = array( | |
2281 | + 'cacheDir' => CACHE_DIR_PATH, | |
2282 | + 'lifeTime' => CACHE_LIFE_TIME, | |
2283 | + ); | |
2281 | 2284 | |
2282 | - $Cache_Lite = new Cache_Lite($options); | |
2285 | + $Cache_Lite = new Cache_Lite($options); | |
2283 | 2286 | |
2284 | - if(!CACHE_SWITCH){ | |
2285 | - | |
2286 | - $Cache_Lite->clean(); | |
2287 | - return array(false,""); | |
2288 | - } | |
2287 | + if(!CACHE_SWITCH){ | |
2289 | 2288 | |
2289 | + $Cache_Lite->clean(); | |
2290 | + return array(false,""); | |
2291 | + } | |
2292 | + | |
2290 | 2293 | $name = md5($name); |
2291 | 2294 | |
2292 | - if ($data = $Cache_Lite->get($name)){ | |
2293 | - $result = $data; | |
2294 | - $flag = true; | |
2295 | - }else { | |
2295 | + if ($data = $Cache_Lite->get($name)){ | |
2296 | + $result = $data; | |
2297 | + $flag = true; | |
2298 | + }else { | |
2296 | 2299 | |
2297 | - $flag = false; | |
2298 | - } | |
2300 | + $flag = false; | |
2301 | + } | |
2299 | 2302 | |
2300 | 2303 | return array($flag,$data); |
2301 | 2304 | } |
@@ -2302,59 +2305,59 @@ | ||
2302 | 2305 | |
2303 | 2306 | function save_cache($name,$value){ |
2304 | 2307 | |
2305 | - if(!defined('CACHE_LITE_PATH')){return array(false,$value);} | |
2308 | + if(!defined('CACHE_LITE_PATH')){return array(false,$value);} | |
2306 | 2309 | |
2307 | 2310 | $name = md5($name); |
2308 | 2311 | |
2309 | 2312 | require_once(CACHE_LITE_PATH); |
2310 | 2313 | |
2311 | - $options = array( | |
2312 | - 'cacheDir' => CACHE_DIR_PATH, | |
2313 | - 'lifeTime' => CACHE_LIFE_TIME, | |
2314 | - ); | |
2314 | + $options = array( | |
2315 | + 'cacheDir' => CACHE_DIR_PATH, | |
2316 | + 'lifeTime' => CACHE_LIFE_TIME, | |
2317 | + ); | |
2315 | 2318 | |
2316 | 2319 | $Cache_Lite = new Cache_Lite($options); |
2317 | - | |
2318 | - if(!CACHE_SWITCH){ | |
2319 | - | |
2320 | - $Cache_Lite->clean(); | |
2321 | - return array(false,$value); | |
2322 | - } | |
2323 | 2320 | |
2324 | - if ($data = $Cache_Lite->get($name)){ | |
2325 | - $result = $data; | |
2326 | - $flag = true; | |
2327 | - }else { | |
2321 | + if(!CACHE_SWITCH){ | |
2328 | 2322 | |
2329 | - $Cache_Lite->save($value,$name); | |
2330 | - //print_r($Cache_Lite); | |
2331 | - $result = $value; | |
2332 | - $flag = false; | |
2333 | - } | |
2323 | + $Cache_Lite->clean(); | |
2324 | + return array(false,$value); | |
2325 | + } | |
2334 | 2326 | |
2327 | + if ($data = $Cache_Lite->get($name)){ | |
2328 | + $result = $data; | |
2329 | + $flag = true; | |
2330 | + }else { | |
2331 | + | |
2332 | + $Cache_Lite->save($value,$name); | |
2333 | + //print_r($Cache_Lite); | |
2334 | + $result = $value; | |
2335 | + $flag = false; | |
2336 | + } | |
2337 | + | |
2335 | 2338 | return array($flag,$value); |
2336 | 2339 | } |
2337 | 2340 | |
2338 | 2341 | function html_document1($ini_array,$documents,$navi="",$source = ""){ |
2339 | 2342 | |
2340 | - global $content_name; | |
2341 | - global $source; | |
2342 | - global $campany_data; | |
2343 | - | |
2344 | - $charset = $ini_array['html_header']['charset']; | |
2345 | - $author = $ini_array['html_header']['author']; | |
2346 | - $keyword = $ini_array['html_header']['keyword']; | |
2347 | - $description = $ini_array['html_header']['description']; | |
2348 | - $mail = $ini_array['html_header']['mail']; | |
2349 | - $stylesheet = $ini_array['html_header']['stylesheet']; | |
2350 | - $style_media = $ini_array['html_header']['style_media']; | |
2351 | - $navi_start = $ini_array['html_header']['start']; | |
2352 | - $navi_prev = $ini_array['html_header']['prev']; | |
2353 | - $navi_next = $ini_array['html_header']['next']; | |
2354 | - $navi_help = $ini_array['html_header']['help']; | |
2355 | - $title = $ini_array['html_header']['title']; | |
2356 | - $embed = $ini_array['html_header']['embed']; | |
2343 | + global $content_name; | |
2344 | + global $source; | |
2345 | + global $campany_data; | |
2357 | 2346 | |
2347 | + $charset = $ini_array['html_header']['charset']; | |
2348 | + $author = $ini_array['html_header']['author']; | |
2349 | + $keyword = $ini_array['html_header']['keyword']; | |
2350 | + $description = $ini_array['html_header']['description']; | |
2351 | + $mail = $ini_array['html_header']['mail']; | |
2352 | + $stylesheet = $ini_array['html_header']['stylesheet']; | |
2353 | + $style_media = $ini_array['html_header']['style_media']; | |
2354 | + $navi_start = $ini_array['html_header']['start']; | |
2355 | + $navi_prev = $ini_array['html_header']['prev']; | |
2356 | + $navi_next = $ini_array['html_header']['next']; | |
2357 | + $navi_help = $ini_array['html_header']['help']; | |
2358 | + $title = $ini_array['html_header']['title']; | |
2359 | + $embed = $ini_array['html_header']['embed']; | |
2360 | + | |
2358 | 2361 | $html=<<<DOC |
2359 | 2362 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" |
2360 | 2363 | "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |