function check_long_words($image, $draw, $text, $maxWidth) { $metrics = $image->queryFontMetrics($draw, $text); if ($metrics['textWidth'] <= $maxWidth) { return array($text); } $words = str_split_unicode($text); $i = 0; while ($i < count($words)) { $currentLine = $words[$i]; if ($i + 1 >= count($words)) { $lines[] = $currentLine; //$lines = $lines + $checked; break; } //Check to see if we can add another word to this line $metrics = $image->queryFontMetrics($draw, $currentLine . $words[$i + 1]); while ($metrics['textWidth'] <= $maxWidth) { //If so, do it and keep doing it! $currentLine .= $words[++$i]; if ($i + 1 >= count($words)) { break; } $metrics = $image->queryFontMetrics($draw, $currentLine . ' ' . $words[$i + 1]); $t++; } //We can't add the next word to this line, so loop to the next line $lines[] = $currentLine; $i++; } return $lines; }
function superColor($str, $arrC = ['red', 'green', 'blue']) { $j = 0; $arr = str_split_unicode($str); $newStr = ''; for ($i = 0; $i < strlen($str); $i++) { if ($arr[$i] != ' ') { if (!$arrC[$j]) { $j = 0; } $newStr .= '<span class="' . $arrC[$j] . '">' . $arr[$i] . '</span>'; $j++; } else { $newStr .= ' '; } } return $newStr; }
public static function code(&$string) { $array = str_split_unicode($string, 1); $firstletter = $array[0]; for ($i = 0; $i < mb_strlen($string, 'UTF-8'); $i++) { switch ($array[$i]) { case 'ं': case 'ः': case 'ऄ': case 'ऍ': case '़': case 'ऽ': case '्': case 'ॎ': case 'ॏ': case 'ॐ': case '॑': case '॒': case '॓': case '॔': case 'ॕ': case 'ॖ': case 'क़': case 'ख़': case 'ग़': case 'ज़': case 'ड़': case 'ढ़': case 'फ़': case 'य़': case '।': case '॥': case '॰': case 'ॱ': case 'ॲ': case 'ॳ': case 'ॴ': case 'ॵ': case 'ॶ': case 'ॷ': case 'ॸ': case 'ॹ': $array[$i] = '0'; break; case 'अ': case 'आ': case 'ा': $array[$i] = 'A'; break; case 'इ': case 'ई': case 'ि': case 'ी': $array[$i] = 'B'; break; case 'उ': case 'ऊ': case 'ु': case 'ू': $array[$i] = 'C'; break; case 'ऎ': case 'ए': case 'ऐ': case 'ॆ': case 'े': case 'ै': case 'ॉ': $array[$i] = 'D'; break; case 'ऑ': case 'ऒ': case 'ओ': case 'औ': case 'ॊ': case 'ो': case 'ौ': case 'ॅ': case 'ॗ': $array[$i] = 'E'; break; case 'क': case 'ख': case 'ग': case 'घ': $array[$i] = 'F'; break; case 'ङ': case 'ञ': $array[$i] = 'G'; break; case 'च': case 'छ': case 'ज': case 'झ': $array[$i] = 'H'; break; case 'ट': case 'ठ': case 'ड': case 'ढ': $array[$i] = 'I'; break; case 'ण': case 'ॺ': case 'ॻ': $array[$i] = 'J'; break; case 'त': case 'थ': case 'द': case 'ध': $array[$i] = 'K'; break; case 'ऩ': $array[$i] = 'L'; break; case 'फ': case 'ब': case 'प': case 'भ': $array[$i] = 'M'; break; case 'म': $array[$i] = 'N'; break; case 'य': $array[$i] = 'O'; break; case 'ऱ': case 'ृ': case 'ॠ': case 'ॽ': case 'ॾ': case 'ऋ': case 'र': case 'ॄ': $array[$i] = 'P'; break; case 'ल': case 'ळ': case 'ऴ': case 'ॡ': case 'ॢ': case 'ॼ': case 'ऌ': case 'ॣ': $array[$i] = 'Q'; break; case 'व': $array[$i] = 'R'; break; case 'श': case 'ष': case 'स': $array[$i] = 'S'; break; case 'ह': $array[$i] = 'T'; break; case '0': $array[$i] = '0'; break; case '1': $array[$i] = '1'; break; case '2': $array[$i] = '2'; break; case '3': $array[$i] = '3'; break; case '4': $array[$i] = '4'; break; case '5': $array[$i] = '5'; break; case '6': $array[$i] = '6'; break; case '7': $array[$i] = '7'; break; case '8': $array[$i] = '8'; break; case '9': $array[$i] = '9'; break; } } $newstring = $firstletter . ""; for ($i = 1; $i < mb_strlen($string, 'UTF-8'); $i++) { $newstring .= $array[$i]; } return $newstring; }
} function prepare_output($items) { $res = []; foreach ($items as $key => $value) { // Make UTF-8 safe results. $safe_value = force_utf8_safe($value); if ($value != $safe_value) { $key .= ' (Invalid characters replaced with ?)'; $value = $safe_value; } $res[$key] = $value; } return $res; } $chars = str_split_unicode($query); if (0) { echo "" . $query . " - " . implode("", $chars) . "\n"; echo "urlencode = " . urlencode($query) . "\n"; echo "utf8_encode = " . utf8_encode($query) . "\n"; echo "htmlentities = " . htmlentities($query, ENT_QUOTES, 'UTF-8', false) . "\n"; $html_encode = ''; $table = get_html_translation_table(HTML_ENTITIES); for ($i = 0, $l = sizeof($chars); $i < $l; $i++) { echo $chars[$i] . " -> " . $table[$chars[$i]] . "\n"; $html_encode .= $table[$chars[$i]] ? $table[$chars[$i]] : $chars[$i]; } $html_encode = htmlentities($html_encode, ENT_QUOTES, 'UTF-8', false); echo " = " . $html_encode . "\n"; echo "base64_encode = " . base64_encode($query) . "\n"; exit;
function str_split_utf16($str) { return str_split_unicode($str); }
function ReplaceKeywords($Matches) { if ($Matches[2]) { $GoodStuff = $Matches[3]; } else { $GoodStuff = $Matches[4]; } if ($GoodStuff !== "") { switch (strtolower($Matches[1])) { case "total": switch (strtolower($GoodStuff)) { case "pages": $pageTotal = mysql_query("Select `ID` from `Wiki_Pages`"); $totalPages = mysql_num_rows($pageTotal); return number_format($totalPages); break; } break; case "ad": $position = strtolower($GoodStuff); if ($position == 'right') { $class = 'right'; } elseif ($position == 'left') { $class = 'left'; } $ID = uuid(); return "<div id='{$ID}' class='{$class}'><iframe id='scraper-friend' src='https://ads.wetfish.net/friendship/scraper.html' style='width:175px; height:640px; border:0; outline:0; overflow:hidden;' scrolling='no'></iframe></div>"; break; case "ads": $ID = uuid(); $ID2 = uuid(); return "<div id='{$ID}' class='left'><iframe id='scraper-friend' src='https://ads.wetfish.net/friendship/scraper.html' style='width:175px; height:640px; border:0; outline:0; overflow:hidden;' scrolling='no'></iframe></div>" . "<div id='{$ID2}' class='right'><iframe id='scraper-friend' src='https://ads.wetfish.net/friendship/scraper.html' style='width:175px; height:640px; border:0; outline:0; overflow:hidden;' scrolling='no'></iframe></div>"; break; case "pre": $GoodStuff = trim(str_replace(array("{", "}", '[', ']'), array("{", "}", '[', ']'), $GoodStuff)); return "<pre>{$GoodStuff}</pre>"; break; case "center": return "<center>{$GoodStuff}</center>"; break; case "magic": $Words = str_split_unicode(html_entity_decode($GoodStuff, false, 'UTF-8')); $Splitter = ''; foreach ($Words as $Word) { $magic .= "<span class='magic'>{$Word}</span>"; } return "<span class='brew'>{$GoodStuff}</span>"; break; case "color": $args = explode("|", $GoodStuff, 3); if (count($args) == 3) { if ($args[1]) { $args[1] = "background-color:{$args[1]}"; } return "<span style='color:{$args[0]}; {$args[1]}'>{$args[2]}</span>"; } elseif (count($args) == 2) { return "<span style='color:{$args[0]}'>{$args[1]}</span>"; } else { return $GoodStuff; } break; case "infobox": $args = explode("|", $GoodStuff, 3); if ($args[2]) { return "<div class='wiki-box' style='{$args[0]}'><div class='wiki-box-title'>{$args[1]}</div>{$args[2]}</div>"; } else { return "<div class='wiki-box'><div class='wiki-box-title'>{$args[0]}</div>{$args[1]}</div>"; } break; case "titlebox": $args = explode("|", $GoodStuff, 2); return "<header class='title-box'><h1>{$args[0]}</h1><span>{$args[1]}</span></header>"; break; case "box": $args = explode("|", $GoodStuff, 2); if ($args[1]) { return "<div class='wiki-box' style='{$args[0]}'>{$args[1]}</div>"; } else { return "<div class='wiki-box'>{$args[0]}</div>"; } break; case "title": return "<div class='wiki-box-title'>{$GoodStuff}</div>"; break; case "style": $args = explode("|", $GoodStuff, 2); $args[0] = preg_replace("/([\\s\n]| )+/", " ", $args[0]); return "<div style='{$args[0]}'>{$args[1]}</div>"; break; case "right": return "<div class='right'>{$GoodStuff}</div>"; break; case "left": return "<div class='left'>{$GoodStuff}</div>"; break; case "bold": case "b": return "<b>{$GoodStuff}</b>"; break; case "underline": case "u": return "<u>{$GoodStuff}</u>"; break; case "italic": case "italics": case "i": return "<i>{$GoodStuff}</i>"; break; case "strike": case "s": return "<span class='strike'>{$GoodStuff}</span>"; break; case "big": return "<span class='big'>{$GoodStuff}</span>"; break; case "medium": case "med": return "<span class='medium'>{$GoodStuff}</span>"; break; case "small": case "sml": return "<span class='small'>{$GoodStuff}</span>"; break; case "redirect": if (isset($_GET['random'])) { return "<meta http-equiv='refresh' content='1;url=/{$GoodStuff}/?random'>You're being brought to '{$GoodStuff}'..."; } else { return "<meta http-equiv='refresh' content='1;url=/{$GoodStuff}'>You're being brought to '{$GoodStuff}'..."; } break; case "heading": //return "<a name='".str_replace(array("<", ">", """, "'", "\", "`", " "), "", $GoodStuff)."'></a>$GoodStuff<hr />"; return "<div class='clear'>{$GoodStuff}</div><hr />"; break; case "subheading": //return "<a name='".str_replace(array("<", ">", """, "'", "\", "`", " "), "", $GoodStuff)."'></a>$GoodStuff<hr />"; return "{$GoodStuff}<hr />"; break; case "url": list($link, $text) = explode("|", $GoodStuff, 2); $link = trim($link); $text = trim($text); $url = parse_url($link); switch ($url['scheme']) { case "http": case "https": case "ftp": case "irc": if (empty($text)) { $text = $link; } return "<a href='{$link}' target='_blank'>{$text}</a>"; break; case "fish": $link = "https://wiki.wetfish.net/{$url['host']}"; if (empty($text)) { $text = $url['host']; } return "<a href='{$link}'>{$text}</a>"; break; default: if (empty($text)) { $text = $link; } return "<a href='http://{$link}' target='_blank'>{$text}</a>"; break; } break; case "image": case "img": //list($Link, $Size, $Position, $Border, $Text) = explode("|", $GoodStuff, 5); $args = explode('|', $GoodStuff, 6); $Link = trim($args[0]); $Border = trim($args[3]); $Text = trim($args[4]); $rand = trim($args[5]); $path = pathinfo($Link); // If a video extension was used if (preg_match('/^(webm|mp4|ogv)$/i', $path['extension'])) { // Output a special html5 player that behaves like a gif $options = array('autoplay' => true, 'controls' => false, 'muted' => true, 'loop' => true); return embed_html5($Link, $options); } // $args[1] = trim(str_replace('px', '', strtolower($args[1]))); // $args[2] = trim(str_replace('px', '', strtolower($args[2]))); $args[1] = trim($args[1]); $args[2] = trim($args[2]); if (empty($args[1])) { $args[1] = 0; } if (is_numeric($args[1]) and (is_string($args[2]) or empty($args[2]))) { $Size = $args[1]; $Position = $args[2]; } elseif (is_string($args[1]) and (is_numeric($args[2]) or empty($args[2]))) { $Size = $args[2]; $Position = $args[1]; } if (strtolower($Position) == "right" or strtolower($Position) == "left") { $Position = "float:{$Position};"; } elseif (strtolower($Position) == "border") { $Border = true; } elseif (empty($Text)) { $Text = $Position; } if ($Border) { $Border = "border: 4px solid #C17EE8; padding:4px; margin-bottom:16px; border-radius:8px; -moz-border-radius:8px; -webkit-border-radius:8px;"; } else { unset($Border); } if (is_numeric($Size) and $Size < 1600 and $Size > 0 and strpos($Link, 'http://') === false) { $Info = pathinfo($Link); // Make sure the file actually exists if (!file_exists(__DIR__ . "/upload/{$Info['basename']}")) { // Display an icon if the image can't be loaded $ImageText = "<a href='#error' class='exempt'><img src='/upload/apple.gif' title='There was an error loading this image' border='0' /></a>"; } else { if (!file_exists(__DIR__ . "/upload/{$Size}_{$Info['basename']}")) { ResizeImage($Link, __DIR__ . "/upload/{$Size}_{$Info['basename']}", $Size); } $ImageText = "<a href='/{$Link}' class='exempt'><img src='/upload/{$Size}_{$Info['basename']}' border='0' /></a>"; } } else { if (strpos($Link, 'http://') === false && strpos($Link, 'https://') === false) { $Link = "/{$Link}"; } unset($Size); $URL = parse_url($Link); // Make sure wiki images exist if (preg_match("{^/upload}", $URL['path']) && !file_exists(__DIR__ . "{$URL['path']}")) { // Display an icon if the image can't be loaded $ImageText = "<a href='#error' class='exempt'><img src='/upload/apple.gif' title='There was an error loading this image' border='0' /></a>"; } else { if ($URL['host'] == "glitch.wetfish.net") { $class = "class='glitchme'"; } // This is a terrible hack and really should be expanded to parse and reconstruct the url if ($rand) { $rand = "&rand=" . mt_rand(); } // Lol I should finish this some time if (is_numeric($Size) and $Size < 1600 and $Size > 0) { $size = "style=''"; } $ImageText = "<img src='{$Link}{$rand}' {$class} />"; } } if ($Text) { $Text = "<div class='small'>{$Text}</div>"; } return "<div style='margin:0px 8px; display:inline-block; max-width:100%; {$Position} {$Border}'>{$ImageText} {$Text}</div>"; break; case "red": case "redtube": $URL = parse_url($GoodStuff); $Video = trim($URL['path'], '/'); return "<object height='344' width='434'> <param name='movie' value='https://embed.redtube.com/player/'> <param name='FlashVars' value='id={$Video}&style=redtube&autostart=false'> <embed src='https://embed.redtube.com/player/?id={$Video}&style=redtube' flashvars='autostart=false' pluginspage='https://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash' type='application/x-shockwave-flash' height='344' width='434' /> </object>"; break; case "motherless": $URL = parse_url($GoodStuff); if ($URL['host'] == "motherless.com") { $Video = trim($URL['path'], '/'); $Data = file_get_contents($GoodStuff); preg_match("/var __file_url = '(.*?)';/", $Data, $Filename); return "<embed type='application/x-shockwave-flash' src='https://motherless.com/flash/player.swf' style='' id='player' name='player' quality='high' allowfullscreen='true' allowscriptaccess='always' wmode='transparent' flashvars='file=https://members.motherless.com/movies/{$Filename['1']}.flv&image=https://motherless.com/thumbs/{$Video}.jpg&mute=false&streamer=lighttpd&link=https://motherless.com/{$Video}' width='680' height='560'>"; } break; case "video": $url = parse_url($GoodStuff); if (preg_match("/(^|\\.)youtube.com\$/i", $url['host'])) { return embed_youtube($GoodStuff); } if (preg_match("/(^|\\.)youtu.be\$/i", $url['host'])) { return embed_youtube($GoodStuff); } if (preg_match("/(^|\\.)vimeo.com\$/i", $url['host'])) { return embed_vimeo($GoodStuff); } if (preg_match("/(^|\\.)vine.co\$/i", $url['host'])) { return embed_vine($GoodStuff); } // Otherwise, it must be a html5 video! return embed_html5($GoodStuff); break; case "youtube": return embed_youtube($GoodStuff); break; case "vimeo": return embed_vimeo($GoodStuff); break; case "vine": return embed_vine($GoodStuff); break; case "playlist": $url = parse_url($GoodStuff); parse_str($url['query'], $query); return "<iframe width='640' height='360' src='https://www.youtube.com/embed/videoseries?list={$query['list']}&index={$query['index']}' frameborder='0' allowfullscreen></iframe>"; break; case "soundcloud": return embed_soundcloud($GoodStuff); break; case "ytcracker": return "<iframe width='100%' height='450' scrolling='no' frameborder='no' src='https://w.soundcloud.com/player/?url=https%3A//api.soundcloud.com/users/2977873&color=ff5500&auto_play=false&hide_related=false&show_artwork=true'></iframe>"; break; case "load": case "embed": $URL = parse_url($GoodStuff); if (empty($URL['scheme'])) { $URL['scheme'] = "http"; } if (empty($URL['host'])) { $URL['host'] = "wiki.wetfish.net"; } if ($URL['path'] == 'index.php' or empty($URL['path']) or $URL['path'] == $_GET['SUPERdickPAGE'] or !empty($_GET['load'])) { $URL['path'] = 'yousosilly.php'; } if (empty($URL['query'])) { $Query = array(); foreach ($_GET as $Key => $Value) { if ($Key != 'SUPERdickPAGE') { $Query[] = "{$Key}=" . urlencode($Value); } } $URL['query'] = implode('&', $Query); } if (preg_match('/^.*\\.?wetfish.net$/i', $URL['host'])) { $ID = uuid(); if ($URL['host'] == 'danger.wetfish.net') { $URL['path'] = substr($URL['path'], 1); if (preg_match("/^[a-f0-9]+\$/", $URL['path'])) { $URL['query'] = "hash={$URL['path']}"; $URL['path'] = "view.php"; } } //return "<iframe src='{$URL['scheme']}://{$URL['host']}/{$URL['path']}?{$URL['query']}' style='height:0px; width:0px; display:none;'></iframe> /**/ if ($URL['host'] != "wiki.wetfish.net") { return "<div id='{$ID}'><script>\$('#{$ID}').load('/load.php?id={$ID}&url={$URL['scheme']}://{$URL['host']}/{$URL['path']}?" . urlencode($URL['query']) . "');</script></div>"; } else { return "<div id='{$ID}'><script>\$('#{$ID}').load('/{$URL['path']}?{$URL['query']}&load=true');</script></div>"; } /**/ //return "LOL GOOGLE HACKED WETFISH"; } break; case "music": list($Derp, $Delay) = explode("|", $GoodStuff, 2); $URL = parse_url($Derp); parse_str($URL['query'], $Query); if (strpos($Derp, 'http://') === false or strpos($Link, 'https://') === false or strpos($Derp, 'http://') !== false and preg_match('/^.*\\.?wetfish.net$/i', $URL['host'])) { if ($Delay) { $Unique = uuid(); $Delay *= 1000; $Javascript = "<script>setTimeout(\"\$('#{$Unique}').show()\", {$Delay})</script>"; return "{$Javascript}<embed id='{$Unique}' src='{$Derp}' width='0' height='0' autostart='true' loop='true' hidden='true' style='display:none;'></embed>"; } else { return "<embed src='{$GoodStuff}' width='0' height='0' autostart='true' loop='true' hidden='true'></embed>"; } } break; case "flash": list($url, $width, $height) = explode("|", $GoodStuff); return "<object width='{$width}' height='{$height}'><param name='movie' value='{$url}'><embed src='{$url}' width='{$width}' height='{$height}'></embed></object>"; break; case "drainbow": case "dblrainbow": case "doublerainbow": case "rainbow2": $Words = str_split_unicode(html_entity_decode($GoodStuff, ENT_QUOTES, 'UTF-8')); $Splitter = ''; foreach ($Words as $Word) { /* $RandomRed = rand(0, 255); $RandomGreen = rand(0, 255); $RandomBlue = rand(0, 255); $InvertedRed = 255 - $RandomRed; $InvertedGreen = 255 - $RandomGreen; $InvertedBlue = 255 - $RandomBlue; */ $rainbowCounter++; $randomHue = $rainbowCounter * 24 % 360; $randomSaturation = rand(0, 5) + 95; $randomLuminosity = rand(0, 24) + 44; $invertedHue = ($randomHue + 180) % 360; //background-color:rgb($InvertedRed, $InvertedGreen, $InvertedBlue); //$Stuff .= "<span style='color:rgb($RandomRed, $RandomGreen, $RandomBlue); background-color:rgb($InvertedRed, $InvertedGreen, $InvertedBlue);'>$Word</span>$Splitter"; $Stuff .= "<span style='font-size:110%; color:hsla({$randomHue}, {$randomSaturation}%, {$randomLuminosity}%, 0.8); text-shadow:1px 1px #000; background-color:hsla({$invertedHue}, {$randomSaturation}%, {$randomLuminosity}%, 0.6);'>" . $Word . "</span>{$Splitter}"; } return $Stuff; break; case "snow": return '<script type="text/javascript" src="/snowstorm.js"></script>'; break; case "rainbow": $Words = str_split_unicode(html_entity_decode($GoodStuff, ENT_QUOTES, 'UTF-8')); $Splitter = ''; foreach ($Words as $Word) { /* $RandomRed = rand(0, 255); $RandomGreen = rand(0, 255); $RandomBlue = rand(0, 255); $InvertedRed = 255 - $RandomRed; $InvertedGreen = 255 - $RandomGreen; $InvertedBlue = 255 - $RandomBlue; */ $rainbowCounter++; $randomHue = -1 * $rainbowCounter * 24 % 360; $randomSaturation = rand(0, 5) + 95; $randomLuminosity = rand(0, 24) + 44; $invertedHue = ($randomHue + 180) % 360; //background-color:rgb($InvertedRed, $InvertedGreen, $InvertedBlue); //$Stuff .= "<span style='color:rgb($RandomRed, $RandomGreen, $RandomBlue); background-color:rgb($InvertedRed, $InvertedGreen, $InvertedBlue);'>$Word</span>$Splitter"; $Stuff .= "<span style='font-size:110%; color:hsla({$randomHue}, {$randomSaturation}%, {$randomLuminosity}%, 0.8); text-shadow:1px 1px #000;'>" . $Word . "</span>{$Splitter}"; } return $Stuff; break; case "glitch": $Splitter = ' '; $Words = preg_split("/{$Splitter}/", $GoodStuff); if (count($Words) == 1) { $Words = str_split($GoodStuff); $Splitter = ''; } foreach ($Words as $Word) { $rainbowCounter++; $randomHue = rand(0, 360); $randomSaturation = rand(0, 5) + 95; $randomLuminosity = rand(0, 44) + 14; $invertedHue = ($randomHue + 180) % 360; $Stuff .= "<span style='font-size:110%; color:hsl({$randomHue}, {$randomSaturation}%, {$randomLuminosity}%); background-color:hsl({$invertedHue}, {$randomSaturation}%, {$randomLuminosity}%);'>{$Word}</span>{$Splitter}"; } return $Stuff; break; case "anchor": return "<a name='{$GoodStuff}'> </a>"; break; case "codepen": return embed_codepen($GoodStuff); break; case "fb": case "fishbux": list($amount, $image) = explode("|", $GoodStuff, 2); // Make sure image is an integer $image = (int) $image; // If none is set, generate a random image if (!$image) { $image = mt_rand(2, 4); } return "<div class='fishbux'> {$amount} <div class='wrap'><img src='/upload/fishbux/bux{$image}.gif'></div></div>"; break; } } else { // Self documenting! if ($Matches[1]) { return $Matches[1] . "[]"; } } }