Was just in the iPhone forum and with any thread I opened it would seem to load fine, however at the bottom; below the copyright bit, I got this:
btw this is long.
btw this is long.
Code:
otherwise strip [x] * @param boolean If true, strip all [quote]...contents...[/quote] * * @return string */ function stripcode(str, ishtml, stripquotes) { if (!is_regexp) { return str; } if (stripquotes) { var start_time = new Date().getTime(); while ((startindex = PHP.stripos(str, '[quote')) !== false) { if (new Date().getTime() - start_time > 2000) { // while loop has been running for over 2 seconds and has probably gone infinite break; } if ((stopindex = PHP.stripos(str, '[/quote]')) !== false) { fragment = str.substr(startindex, stopindex - startindex + 8); str = str.replace(fragment, ''); } else { break; } str = PHP.trim(str); } } if (ishtml) { // exempt image tags -- they need to count as characters in the string // as the do as BB codes str = str.replace(/]+src="([^"]+)"[^>]*>/gi, '$1'); var html1 = new RegExp("<(\\w+)[^>]*>", 'gi'); var html2 = new RegExp("<\\/\\w+>", 'gi'); str = str.replace(html1, ''); str = str.replace(html2, ''); var html3 = new RegExp('( )', 'gi'); str = str.replace(html3, ' '); } else { var bbcode1 = new RegExp("\\[(\\w+)(=[^\\]]*)?\\]", 'gi'); var bbcode2 = new RegExp("\\[\\/(\\w+)\\]", 'gi'); str = str.replace(bbcode1, ''); str = str.replace(bbcode2, ''); } return str; } // ############################################################################# // vB_PHP_Emulator class // ############################################################################# /** * PHP Function Emulator Class */ function vB_PHP_Emulator() { } // ============================================================================= // vB_PHP_Emulator Methods /** * Find a string within a string (case insensitive) * * @param string Haystack * @param string Needle * @param integer Offset * * @return mixed Not found: false / Found: integer position */ vB_PHP_Emulator.prototype.stripos = function(haystack, needle, offset) { if (typeof offset == 'undefined') { offset = 0; } index = haystack.toLowerCase().indexOf(needle.toLowerCase(), offset); return (index == -1 ? false : index); } /** * Trims leading whitespace * * @param string String to trim * * @return string */ vB_PHP_Emulator.prototype.ltrim = function(str) { return str.replace(/^\s+/g, ''); } /** * Trims trailing whitespace * * @param string String to trim * * @return string */ vB_PHP_Emulator.prototype.rtrim = function(str) { return str.replace(/(\s+)$/g, ''); } /** * Trims leading and trailing whitespace * * @param string String to trim * * @return string */ vB_PHP_Emulator.prototype.trim = function(str) { return this.ltrim(this.rtrim(str)); } /** * Emulation of PHP's preg_quote() * * @param string String to process * * @return string */ vB_PHP_Emulator.prototype.preg_quote = function(str) { // replace + { } ( ) [ ] | / ? ^ $ \ . = ! < > : * with backslash+character return str.replace(/(\+|\{|\}|\(|\)|\[|\]|\||\/|\?|\^|\$|\\|\.|\=|\!|\<|\>|\:|\*)/g, "\\$1"); } /** * Emulates PHP's preg_match_all()... sort of * * @param string Haystack * @param string Regular expression - to be inserted into RegExp(x) * * @return mixed Array on match, false on no match */ vB_PHP_Emulator.prototype.match_all = function(string, regex) { var gmatch = string.match(RegExp(regex, "gim")); if (gmatch) { var matches = new Array(); var iregex = new RegExp(regex, "im"); for (var i = 0; i < gmatch.length; i++) { matches[matches.length] = gmatch[i].match(iregex); } return matches; } else { return false; } } /** * Emulates unhtmlspecialchars in vBulletin * * @param string String to process * * @return string */ vB_PHP_Emulator.prototype.unhtmlspecialchars = function(str) { f = new Array(/</g, />/g, /"/g, /&/g); r = new Array('<', '>', '"', '&'); for (var i in f) { str = str.replace(f[i], r[i]); } return str; } /** * Unescape CDATA from vB_AJAX_XML_Builder PHP class * * @param string Escaped CDATA * * @return string */ vB_PHP_Emulator.prototype.unescape_cdata = function(str) { var r1 = /<\=\!\=\[\=C\=D\=A\=T\=A\=\[/g; var r2 = /\]\=\]\=>/g; return str.replace(r1, ''); } /** * Emulates PHP's htmlspecialchars() * * @param string String to process * * @return string */ vB_PHP_Emulator.prototype.htmlspecialchars = function(str) { //var f = new Array(/&(?!#[0-9]+;)/g, //g, /"/g); var f = new Array( (is_mac && is_ie ? new RegExp('&', 'g') : new RegExp('&(?!#[0-9]+;)', 'g')), new RegExp('<', 'g'), new RegExp('>', 'g'), new RegExp('"', 'g') ); var r = new Array( '&', '<', '>', '"' ); for (var i = 0; i < f.length; i++) { str = str.replace(f[i], r[i]); } return str; } /** * Searches an array for a value * * @param string Needle * @param array Haystack * @param boolean Case insensitive * * @return integer Not found: -1 / Found: integer index */ vB_PHP_Emulator.prototype.in_array = function(ineedle, haystack, caseinsensitive) { var needle = new String(ineedle); if (caseinsensitive) { needle = needle.toLowerCase(); for (var i in haystack) { if (haystack[i].toLowerCase() == needle) { return i; } } } else { for (var i in haystack) { if (haystack[i] == needle) { return i; } } } return -1; } /** * Emulates PHP's strpad() * * @param string Text to pad * @param integer Length to pad * @param string String with which to pad * * @return string */ vB_PHP_Emulator.prototype.str_pad = function(text, length, padstring) { text = new String(text); padstring = new String(padstring); if (text.length < length) { padtext = new String(padstring); while (padtext.length < (length - text.length)) { padtext += padstring; } text = padtext.substr(0, (length - text.length)) + text; } return text; } /** * A sort of emulation of PHP's urlencode - not 100% the same, but accomplishes the same thing * * @param string String to encode * * @return string */ vB_PHP_Emulator.prototype.urlencode = function(text) { text = escape(text.toString()).replace(/\+/g, "%2B"); // this escapes 128 - 255, as JS uses the unicode code points for them. // This causes problems with submitting text via AJAX with the UTF-8 charset. var matches = text.match(/(%([0-9A-F]{2}))/gi); if (matches) { for (var matchid = 0; matchid < matches.length; matchid++) { var code = matches[matchid].substring(1,3); if (parseInt(code, 16) >= 128) { text = text.replace(matches[matchid], '' + code); } } } // %25 gets translated to % by PHP, so if you have %25u1234, // we see it as ሴ and it gets translated. So make it ሴ, // which will print as ሴ! text = text.replace('%25', '%'); return text; } /** * Works a bit like ucfirst, but with some extra options * * @param string String with which to work * @param string Cut off string before first occurence of this string * * @return string */ vB_PHP_Emulator.prototype.ucfirst = function(str, cutoff) { if (typeof cutoff != 'undefined') { var cutpos = str.indexOf(cutoff); if (cutpos > 0) { str = str.substr(0, cutpos); } } str = str.split(' '); for (var i = 0; i < str.length; i++) { str[i] = str[i].substr(0, 1).toUpperCase() + str[i].substr(1); } return str.join(' '); } //*