<!-- Begin of code --> <!-- //// carraMeL v.1001 //// copyright Flocons de Paques, 2005. www.floconsdepaques.com //// modified : Flocons de Paques, 2005. www.floconsdepaques.com //// The following code is open-source and free, but is copyrighted. //// //// You are entitled to use it and share it as long as : //// - you do not modify the code ; //// - you do not make money of it (for example, you cannot include it on a CD-ROM included in a magazine for sale, //// or on a website with paid private access, and the like) ; //// - you keep these comments intact, even if you modify the code below ; //// //// You are entitled to modify the code but : //// - you must send a copy of the modified script to Flocons de Paques (see e-mail address on the website) ; //// - you must not share the code as long as changes has not been accepted. //// If your modifications are accepted, your name and website address will be added on the "modified" line above. //// //// Subjetc to this license is code between html comments "Begin of code" and "End of code" //// Feedbacks welcome --> <div align="center"> <h1><a href="http://www.floconsdepaques.com">carraMeL</a></h1> <h2>v. 1.000</h2> <table width="479" border="0" cellspacing="0" cellpadding="2"> <tr bgcolor="#ffebcd"> <th></th> </tr> <tr> <td> <form action="./" method="get" name="FormName"> <p></p> <table width="338" border="0" cellspacing="2" cellpadding="0"> <tr> <th align="left">carraMeLize</th> <th>:</th> <td><input type="text" name="toCar" value="TestCarraMLd.car" size="24" border="0"></td> <th align="left"><input type="submit" name="Go" value="carramelize" border="0"></th> </tr> <tr> <th>decarraMeLize</th> <th>:</th> <td><input type="text" name="toDecar" value="TestCarraMLd.xml" size="24" border="0"></td> <td><input type="submit" name="Go" value="decarramelize" border="0"></td> </tr> <tr> <td align="left" nowrap><b>Voir les fichiers exemple</b></td> <td>:</td> <td><a href="TestCarraML.car" target="_blank">TestCarraML.car</a></td> <td align="center"><a href="TestCarraMLd.xml" target="_blank">TestCarraMLd.xml</a></td> </tr> </table> </form> </td> </tr> <tr> <th align="left">Resultat</th> </tr> <tr> <td> <?php if ($_REQUEST["Go"] == "carramelize") { echo "<div class=\"tinBorder\">"; $fpA = fopen($_REQUEST["toCar"],"r"); $indent = 0; $cdataBegun = "N"; echo "<p><?xml version=\"1.0\"?></p>"; echo "<p><carraMeL1001></p>"; while ($ligneA = ltrim(fgets($fpA, 1024)," ")) { $autreStyle = ";background-color:rgb(".(255-($indent*10)).",255,".(255-($indent*10)).")"; $pos = strpos($ligneA, " "); if ($pos === false and substr($ligneA,0,1) != "}") { if ($cdataBegun == "N") { echo "<p style=\"padding-left:".($indent*10)."px$autreStyle\"><![CDATA[".htmlspecialchars($ligneA)."<br />\r\n"; $cdataBegun = "Y"; } else { echo htmlspecialchars($ligneA)."<br />\r\n"; } } if (substr($ligneA, -3,1) == "{") { $elemName = substr($ligneA,0,$pos); echo "<p style=\"padding-left:".($indent*10)."px$autreStyle\"><$elemName></p>\r\n"; $elemTable[] = $elemName; $indent++; } elseif (substr($ligneA, -3,1) == "}") { if ($cdataBegun == "Y") { echo "]]></p>\r\n"; $cdataBegun = "N"; } $indent--; $elemName = array_pop($elemTable); $autreStyle = ";background-color:rgb(".(255-($indent*10)).",255,".(255-($indent*10)).")"; echo "<p style=\"padding-left:".($indent*10)."px$autreStyle\"></$elemName></p>\r\n"; } elseif ($cdataBegun != "Y") { $elemName = substr($ligneA,0,$pos); $elemValue = substr($ligneA,$pos+1,-2); echo "<p style=\"padding-left:".($indent*10)."px$autreStyle\"><$elemName>$elemValue</$elemName></p>\r\n"; } } echo "<p></carraMeL1000></p>"; echo "</div>"; } if ($_REQUEST["Go"] == "decarramelize") { echo "<div class=\"tinBorder\">"; $fpA = fopen($_REQUEST["toDecar"],"r"); $indent = 0; while ($ligneA = fgets($fpA, 1024)) { $patastuff = str_repeat(" ", $indent); if (substr($ligneA,0,5) == "<?xml" OR substr($ligneA,0,9) == "<carraMeL" OR substr($ligneA,0,10) == "</carraMeL") { } elseif (substr($ligneA,0,2) == "</") { echo "<p>".$patastuff."}</p>\r\n"; $indent--; } elseif (preg_match(":<(.*)>(.*)</.*>:", $ligneA, $matches) != 0) { echo "<p>".$patastuff.$matches[1]." ".$matches[2]."</p>\r\n"; } elseif (preg_match(":<(.*)>$:", $ligneA, $matches) != 0) { echo "<p>".$patastuff.$matches[1]." {</p>\r\n"; $indent++; } elseif (substr($ligneA, 0, 9) == "<![CDATA[") { echo "<p>".$patastuff.substr($ligneA,9)."</p>\r\n"; } elseif (substr($ligneA, 0, 3) == "]]>") { echo ""; } elseif ($ligneA == "\r\n" or $ligneA == "\r" or $ligneA == "\n") { } else { echo "<p>".$patastuff.htmlspecialchars($ligneA)."</p>\r\n"; } } echo "</div>"; } ?> </td> </tr> <tr bgcolor="#ffebcd" height="5"> <td height="5"></td> </tr> </table> </div> <!-- End of code -->
Cette page utilise le script Syntax Highlighter © 2011 Dream Projections sous license MIT
Easter Flakes • Flocons de Pâques | Nous contacter
© Easter Flakes - 2007. Tous droits rĂ©servĂ©s sur toutes images, textes et codes.