Zoopy Vbulletin Embed Code Converter
Here is a quick-and-dirty script I hacked together to convert Zoopy's HTML embed code into vBulletin code for embedding on a forum.
<?php if (isset($_POST['html'])) { try
{ $html = sprintf('<div>%s</div>', $_POST['html']);
$div = @new SimpleXMLElement(trim($html)); $vb = array();
foreach ($div->a as $a) { $vb[] = sprintf('[URL="%s"]
[IMG]%s[/IMG][/URL]', $a['href'], $a->img['src']); }
$vb = sprintf('[CENTER]%s[/CENTER]', implode(' ', $vb)); }
catch (Exception $e) { $error = true; } } ?>
<!DOCTYPE HTML> <html lang="en"> <head>
<title>Zoopy vBulletin Embed Code Converter</title>
<link rel="stylesheet" type="text/css" href="style.css">
</head> <body> <h1>Zoopy vBulletin Embed Code Converter
</h1> <?php if (isset($error)) : ?> <p class="error">
Some of the code you pasted does not seem to be valid Zoopy
embed code.</p> <?php endif; ?> <form method="post">
<p><textarea name="html"><?php if (isset($_POST['html']))
echo htmlspecialchars($_POST['html']); ?></textarea></p>
<p><button>Convert</button></p> <?php if (isset($vb) &&
$vb) : ?> <p><textarea id="vb" readonly="readonly"
onclick="this.select()"><?php echo htmlspecialchars($vb); ?>
</textarea></p> <script type="application/javascript">
document.getElementById("vb").select()</script>
<?php endif; ?> </form> <footer> <p>Copyright 2015
web4that.com. No rights reserved.</p> </footer> </body> </html>
html { background: #ddd; } body { margin: 40px; padding: 0;
border: 2px solid #aaa; font: 0.8em/1.6 verdana, arial,
sans-serif; text-align: center; background: white; } h1
{ font-size: 2em; font-weight: normal; } p { margin: 0;
padding: 5px 20px; } .error { color: #CC8500; } textarea {
width: 100%; height: 100px; } textarea[readonly] {
background: #eee; } footer p { margin-top: 20px;
border-top: 1px solid #ccc; color: #555; background: #eee; }