Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/php
- <?php
- //echo "kopeteHistXml2Html.php - Exporting Kopete history xml-files to html (CLI-Version)";
- $doc=simplexml_load_file($argv[1]);
- //var_dump($doc);
- $new_msgs=array();
- foreach ($doc->msg as $msg) {
- $a=$msg->attributes();
- $msg_p=array("nick"=>(string)$a->nick,"in?"=>((string)$a->in=="1"),"time"=>(string)$a->time,"text"=>(string)$msg);
- $new_msgs[]=$msg_p;
- }
- ?>
- <!DOCTYPE html>
- <html>
- <head>
- <meta charset="utf-8" />
- <title>Chatlog</title>
- <style>
- * {padding:0;margin:0;}
- body {font-size:12px; width:600px; margin:0 auto;font-family:Tahoma, sans-serif;}
- h1 {margin:20px 0 50px 0;text-align:center;}
- .out {text-align:right;padding-right:300px;}
- .in {text-align:left;padding-left:300px;}
- dt {font-size:8px;color:#999;}
- dd {padding-bottom:10px;}
- </style>
- </head>
- <body>
- <h1>Chatlog</h1>
- <dl>
- <?php foreach ($new_msgs as $ms) : ?>
- <dt class="<?php echo ($ms["in?"]?"in":"out"); ?>"><?php echo htmlspecialchars($ms["nick"]); ?></dt>
- <dd class="<?php echo ($ms["in?"]?"in":"out"); ?>"><?php echo htmlspecialchars($ms["text"]); ?></dd>
- <?php endforeach; ?>
- </dl>
- </body>
- </html>
Add Comment
Please, Sign In to add comment