<?php

/**
* @package   s9e\TextFormatter
* @copyright Copyright (c) 2010-2016 The s9e Authors
* @license   http://www.opensource.org/licenses/mit-license.php The MIT License
*/
class s9e_renderer_df792bacf3cd2a58e8fea574b99be4073a9f8c6d extends \s9e\TextFormatter\Renderer
{
	protected $params=array('L_ABBC3_OFFTOPIC'=>'','L_ABBC3_SPOILER_HIDE'=>'','L_ABBC3_SPOILER_SHOW'=>'','L_CODE'=>'','L_COLON'=>'','L_FROM'=>'','L_IMAGE'=>'','L_MESSAGE'=>'','L_SELECT_ALL_CODE'=>'','L_WROTE'=>'','STYLE_ID'=>'','S_VIEWFLASH'=>'','S_VIEWIMG'=>'','S_VIEWSMILIES'=>'','T_SMILIES_PATH'=>'');
	protected static $tagBranches=array('ALIGN'=>0,'ATTACHMENT'=>1,'B'=>2,'BBVIDEO'=>3,'BLINK'=>4,'BLUR'=>5,'CODE'=>6,'COLOR'=>7,'COLOR2'=>8,'DIR'=>9,'DROPSHADOW'=>10,'E'=>11,'EMAIL'=>12,'EMOJI'=>13,'FADE'=>14,'FLASH'=>15,'FLOAT'=>16,'FONT'=>17,'GLOW'=>18,'HIDDEN'=>19,'HIGHLIGHT'=>20,'I'=>21,'IMG'=>22,'LI'=>23,'LINK_TEXT'=>24,'LIST'=>25,'MARQ'=>26,'MOD'=>27,'NFO'=>28,'OFFTOPIC'=>29,'PRE'=>30,'QUOTE'=>31,'S'=>32,'SHADOW'=>33,'SIZE'=>34,'SOUNDCLOUD'=>35,'SPOIL'=>36,'STRIKE'=>37,'SUB'=>38,'SUP'=>39,'U'=>40,'URL'=>41,'YOUTUBE'=>42,'br'=>43,'e'=>44,'i'=>44,'s'=>44,'p'=>45);
	protected static $btA66C2C3F=array('8-)'=>0,':!:'=>1,':('=>2,':)'=>3,':-('=>4,':-)'=>5,':-?'=>6,':-D'=>7,':-P'=>8,':-o'=>9,':-x'=>10,':-|'=>11,':?'=>12,':?:'=>13,':???:'=>14,':D'=>15,':P'=>16,':arrow:'=>17,':cool:'=>18,':cry:'=>19,':eek:'=>20,':evil:'=>21,':geek:'=>22,':grin:'=>23,':idea:'=>24,':lol:'=>25,':mad:'=>26,':mrgreen:'=>27,':o'=>28,':oops:'=>29,':razz:'=>30,':roll:'=>31,':sad:'=>32,':shock:'=>33,':smile:'=>34,':twisted:'=>35,':ugeek:'=>36,':wink:'=>37,':x'=>38,':|'=>39,';)'=>40,';-)'=>41);
	public function __sleep()
	{
		$props = get_object_vars($this);
		unset($props['out'], $props['proc'], $props['source']);
		return array_keys($props);
	}
	public function renderRichText($xml)
	{
		if (!isset($this->quickRenderingTest) || !preg_match($this->quickRenderingTest, $xml))
			try
			{
				return $this->renderQuick($xml);
			}
			catch (\Exception $e)
			{
			}
		$dom = $this->loadXML($xml);
		$this->out = '';
		$this->at($dom->documentElement);
		return $this->out;
	}
	protected function at(\DOMNode $root)
	{
		if ($root->nodeType === 3)
			$this->out .= htmlspecialchars($root->textContent,0);
		else
			foreach ($root->childNodes as $node)
				if (!isset(self::$tagBranches[$node->nodeName]))
					$this->at($node);
				else
				{
					$tb = self::$tagBranches[$node->nodeName];
					if($tb<23)if($tb<12)if($tb<6)if($tb<3)if($tb===0){$this->out.='<span style="text-align:'.htmlspecialchars($node->getAttribute('align'),2).'; display:block;">';$this->at($node);$this->out.='</span>';}elseif($tb===1)$this->out.='<div class="inline-attachment"><!-- ia'.htmlspecialchars($node->getAttribute('index'),0).' -->'.htmlspecialchars($node->getAttribute('filename'),0).'<!-- ia'.htmlspecialchars($node->getAttribute('index'),0).' --></div>';elseif($this->params['STYLE_ID']==7||$this->params['STYLE_ID']==8||$this->params['STYLE_ID']==9){$this->out.='<strong>';$this->at($node);$this->out.='</strong>';}else{$this->out.='<span style="font-weight: bold">';$this->at($node);$this->out.='</span>';}elseif($tb===3)$this->out.='<a href="'.htmlspecialchars($node->getAttribute('content'),2).'" class="bbvideo" data-bbvideo="'.htmlspecialchars($node->getAttribute('bbvideo0'),2).','.htmlspecialchars($node->getAttribute('bbvideo1'),2).'" target="_blank" rel="noreferrer">'.htmlspecialchars($node->getAttribute('content'),0).'</a>';elseif($tb===4){$this->out.='<blink>';$this->at($node);$this->out.='</blink>';}else{$this->out.='<span class="blur" style="display: inline; padding: 0 6px; color: transparent; text-shadow: 0 0 0.2em '.htmlspecialchars($node->getAttribute('blur'),2).';">';$this->at($node);$this->out.='</span>';}elseif($tb<9)if($tb===6){$this->out.='<div class="codebox"><p>'.htmlspecialchars($this->params['L_CODE'].$this->params['L_COLON'],0).' <a href="#" onclick="selectCode(this); return false;">'.htmlspecialchars($this->params['L_SELECT_ALL_CODE'],0).'</a></p>';if($this->params['STYLE_ID']==1||$this->params['STYLE_ID']==7||$this->params['STYLE_ID']==8){$this->out.='<pre><code>';$this->at($node);$this->out.='</code></pre>';}else{$this->out.='<code>';$this->at($node);$this->out.='</code>';}$this->out.='</div>';}elseif($tb===7){$this->out.='<span style="color: '.htmlspecialchars($node->getAttribute('color'),2).'">';$this->at($node);$this->out.='</span>';}else{$this->out.='<div style="color: '.htmlspecialchars($node->getAttribute('color2'),2).'">';$this->at($node);$this->out.='</div>';}elseif($tb===9){$this->out.='<bdo dir="'.htmlspecialchars($node->getAttribute('dir'),2).'">';$this->at($node);$this->out.='</bdo>';}elseif($tb===10){$this->out.='<span class="dropshadow" style="display: inline; padding: 0 6px; color: '.htmlspecialchars($node->getAttribute('dropshadow'),2).'; text-shadow: -1px 1px 0 #999;">';$this->at($node);$this->out.='</span>';}elseif(empty($this->params['S_VIEWSMILIES']))$this->out.=htmlspecialchars($node->textContent,0);elseif(isset(self::$btA66C2C3F[$node->textContent])){$n=self::$btA66C2C3F[$node->textContent];$this->out.='<img class="smilies" src="'.htmlspecialchars($this->params['T_SMILIES_PATH'],2);if($n<21)if($n<11)if($n<6)if($n<3)if($n===0)$this->out.='/icon_cool.gif" width="15" height="17" alt="8-)" title="Cool">';elseif($n===1)$this->out.='/icon_exclaim.gif" width="15" height="17" alt=":!:" title="Exclamation">';else$this->out.='/icon_e_sad.gif" width="15" height="17" alt=":(" title="Sad">';elseif($n===3)$this->out.='/icon_e_smile.gif" width="15" height="17" alt=":)" title="Smile">';elseif($n===4)$this->out.='/icon_e_sad.gif" width="15" height="17" alt=":-(" title="Sad">';else$this->out.='/icon_e_smile.gif" width="15" height="17" alt=":-)" title="Smile">';elseif($n<9)if($n===6)$this->out.='/icon_e_confused.gif" width="15" height="17" alt=":-?" title="Confused">';elseif($n===7)$this->out.='/icon_e_biggrin.gif" width="15" height="17" alt=":-D" title="Very Happy">';else$this->out.='/icon_razz.gif" width="15" height="17" alt=":-P" title="Razz">';elseif($n===9)$this->out.='/icon_e_surprised.gif" width="15" height="17" alt=":-o" title="Surprised">';else$this->out.='/icon_mad.gif" width="15" height="17" alt=":-x" title="Mad">';elseif($n<16)if($n<14)if($n===11)$this->out.='/icon_neutral.gif" width="15" height="17" alt=":-|" title="Neutral">';elseif($n===12)$this->out.='/icon_e_confused.gif" width="15" height="17" alt=":?" title="Confused">';else$this->out.='/icon_question.gif" width="15" height="17" alt=":?:" title="Question">';elseif($n===14)$this->out.='/icon_e_confused.gif" width="15" height="17" alt=":???:" title="Confused">';else$this->out.='/icon_e_biggrin.gif" width="15" height="17" alt=":D" title="Very Happy">';elseif($n<19)if($n===16)$this->out.='/icon_razz.gif" width="15" height="17" alt=":P" title="Razz">';elseif($n===17)$this->out.='/icon_arrow.gif" width="15" height="17" alt=":arrow:" title="Arrow">';else$this->out.='/icon_cool.gif" width="15" height="17" alt=":cool:" title="Cool">';elseif($n===19)$this->out.='/icon_cry.gif" width="15" height="17" alt=":cry:" title="Crying or Very Sad">';else$this->out.='/icon_e_surprised.gif" width="15" height="17" alt=":eek:" title="Surprised">';elseif($n<32)if($n<27)if($n<24)if($n===21)$this->out.='/icon_evil.gif" width="15" height="17" alt=":evil:" title="Evil or Very Mad">';elseif($n===22)$this->out.='/icon_e_geek.gif" width="17" height="17" alt=":geek:" title="Geek">';else$this->out.='/icon_e_biggrin.gif" width="15" height="17" alt=":grin:" title="Very Happy">';elseif($n===24)$this->out.='/icon_idea.gif" width="15" height="17" alt=":idea:" title="Idea">';elseif($n===25)$this->out.='/icon_lol.gif" width="15" height="17" alt=":lol:" title="Laughing">';else$this->out.='/icon_mad.gif" width="15" height="17" alt=":mad:" title="Mad">';elseif($n<30)if($n===27)$this->out.='/icon_mrgreen.gif" width="15" height="17" alt=":mrgreen:" title="Mr. Green">';elseif($n===28)$this->out.='/icon_e_surprised.gif" width="15" height="17" alt=":o" title="Surprised">';else$this->out.='/icon_redface.gif" width="15" height="17" alt=":oops:" title="Embarrassed">';elseif($n===30)$this->out.='/icon_razz.gif" width="15" height="17" alt=":razz:" title="Razz">';else$this->out.='/icon_rolleyes.gif" width="15" height="17" alt=":roll:" title="Rolling Eyes">';elseif($n<37)if($n<35)if($n===32)$this->out.='/icon_e_sad.gif" width="15" height="17" alt=":sad:" title="Sad">';elseif($n===33)$this->out.='/icon_eek.gif" width="15" height="17" alt=":shock:" title="Shocked">';else$this->out.='/icon_e_smile.gif" width="15" height="17" alt=":smile:" title="Smile">';elseif($n===35)$this->out.='/icon_twisted.gif" width="15" height="17" alt=":twisted:" title="Twisted Evil">';else$this->out.='/icon_e_ugeek.gif" width="17" height="18" alt=":ugeek:" title="Uber Geek">';elseif($n<40)if($n===37)$this->out.='/icon_e_wink.gif" width="15" height="17" alt=":wink:" title="Wink">';elseif($n===38)$this->out.='/icon_mad.gif" width="15" height="17" alt=":x" title="Mad">';else$this->out.='/icon_neutral.gif" width="15" height="17" alt=":|" title="Neutral">';elseif($n===40)$this->out.='/icon_e_wink.gif" width="15" height="17" alt=";)" title="Wink">';else$this->out.='/icon_e_wink.gif" width="15" height="17" alt=";-)" title="Wink">';}else$this->out.=htmlspecialchars($node->textContent,0);elseif($tb<18)if($tb<15)if($tb===12){$this->out.='<a href="mailto:'.htmlspecialchars($node->getAttribute('email'),2);if($node->hasAttribute('subject')||$node->hasAttribute('body')){$this->out.='?';if($node->hasAttribute('subject'))$this->out.='subject='.htmlspecialchars($node->getAttribute('subject'),2);if($node->hasAttribute('body')){if($node->hasAttribute('subject'))$this->out.='&amp;';$this->out.='body='.htmlspecialchars($node->getAttribute('body'),2);}}$this->out.='">';$this->at($node);$this->out.='</a>';}elseif($tb===13)if(!empty($this->params['S_VIEWSMILIES']))$this->out.='<img alt="'.htmlspecialchars($node->textContent,2).'" class="emoji smilies" draggable="false" src="//cdn.jsdelivr.net/emojione/assets/svg/'.htmlspecialchars($node->getAttribute('seq'),2).'.svg">';else$this->out.=htmlspecialchars($node->textContent,0);else{$this->out.='<span class="fadeEffect">';$this->at($node);$this->out.='</span>';}elseif($tb===15)if(!empty($this->params['S_VIEWFLASH']))$this->out.='<object classid="clsid:D27CDB6E-AE6D-11CF-96B8-444553540000" codebase="http://active.macromedia.com/flash2/cabs/swflash.cab#version=5,0,0,0" width="'.htmlspecialchars($node->getAttribute('width'),2).'" height="'.htmlspecialchars($node->getAttribute('height'),2).'"><param name="movie" value="'.htmlspecialchars($node->getAttribute('url'),2).'"><param name="play" value="false"><param name="loop" value="false"><param name="quality" value="high"><param name="allowScriptAccess" value="never"><param name="allowNetworking" value="internal"><embed src="'.htmlspecialchars($node->getAttribute('url'),2).'" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" width="'.htmlspecialchars($node->getAttribute('width'),2).'" height="'.htmlspecialchars($node->getAttribute('height'),2).'" play="false" loop="false" quality="high" allowscriptaccess="never" allownetworking="internal"></object>';else$this->at($node);elseif($tb===16){$this->out.='<div style="float:'.htmlspecialchars($node->getAttribute('float'),2).'; padding:0 10px;">';$this->at($node);$this->out.='</div>';}else{$this->out.='<span style="font-family: '.htmlspecialchars($node->getAttribute('font'),2).';">';$this->at($node);$this->out.='</span>';}elseif($tb<21)if($tb===18){$this->out.='<span class="glow" style="display: inline; padding: 0 6px; color: #ffffff; text-shadow: 0 0 1em '.htmlspecialchars($node->getAttribute('glow'),2).', 0 0 1em '.htmlspecialchars($node->getAttribute('glow'),2).', 0 0 1.2em '.htmlspecialchars($node->getAttribute('glow'),2).';">';$this->at($node);$this->out.='</span>';}elseif($tb===19){$this->out.='<!-- ABBC3_BBCODE_HIDDEN -->';$this->at($node);$this->out.='<!-- ABBC3_BBCODE_HIDDEN -->';}else{$this->out.='<span style="background-color: '.htmlspecialchars($node->getAttribute('highlight'),2).';">';$this->at($node);$this->out.='</span>';}elseif($tb===21)if($this->params['STYLE_ID']==7||$this->params['STYLE_ID']==8||$this->params['STYLE_ID']==9){$this->out.='<em>';$this->at($node);$this->out.='</em>';}else{$this->out.='<span style="font-style: italic">';$this->at($node);$this->out.='</span>';}elseif(!empty($this->params['S_VIEWIMG']))$this->out.='<img src="'.htmlspecialchars($node->getAttribute('src'),2).'" class="postimage" alt="'.htmlspecialchars($this->params['L_IMAGE'],2).'">';else$this->at($node);elseif($tb<35)if($tb<29)if($tb<26)if($tb===23){$this->out.='<li>';$this->at($node);$this->out.='</li>';}elseif($tb===24)$this->out.=htmlspecialchars($node->getAttribute('text'),0);elseif(!$node->hasAttribute('type')){$this->out.='<ul>';$this->at($node);$this->out.='</ul>';}elseif((strpos('upperlowerdecim',mb_substr($node->getAttribute('type'),0,5,'utf-8'))!==false)){$this->out.='<ol style="list-style-type: '.htmlspecialchars($node->getAttribute('type'),2).'">';$this->at($node);$this->out.='</ol>';}else{$this->out.='<ul style="list-style-type: '.htmlspecialchars($node->getAttribute('type'),2).'">';$this->at($node);$this->out.='</ul>';}elseif($tb===26){$this->out.='<marquee class="abbc3_marquee" direction="'.htmlspecialchars($node->getAttribute('marq'),2).'" scrolldelay="100" onmouseover="this.scrollDelay=10000000;" onmouseout="this.scrollDelay=100;" style="margin: 10px 0; padding: 5px; display: inline-block;">';$this->at($node);$this->out.='</marquee>';}elseif($tb===27){$this->out.='<table class="ModTable" style="background-color:#FFFFFF;border:1px solid #000000;border-collapse:separate;border-spacing:5px;padding:0;width:100%;color:#333333;overflow:hidden;"><tr><td class="exclamation" rowspan="2" style="background-color:#ff6060;font-weight:bold;font-family:\'Times New Roman\',Verdana,sans-serif;font-size:4em;color:#ffffff;vertical-align:middle;text-align:center;width:1%;"> ! </td><td class="rowuser" style="border-bottom:1px solid #000000;font-weight:bold;">'.htmlspecialchars($this->params['L_MESSAGE'],0).' '.htmlspecialchars($this->params['L_FROM'].$this->params['L_COLON'],0).' '.htmlspecialchars($node->getAttribute('mod'),0).'</td></tr><tr><td class="rowtext">';$this->at($node);$this->out.='</td></tr></table>';}else{$this->out.='<pre class="nfo" style="color: #000000; font-weight: normal; line-height: normal; font-size: 10pt; font-family: Terminal, monospace; background-color: #ffffff; white-space: pre; padding: 5px;">';$this->at($node);$this->out.='</pre>';}elseif($tb<32)if($tb===29){$this->out.='<div class="offtopic" style="position:relative;margin:5px 0;padding:39px 19px 14px;background:#fff;border:1px solid #ddd;border-radius:4px;"><div class="offtopic_title" style="position:absolute;top:-1px;left:-1px;font-family:\'Helvetica Neue\', Helvetica, Arial, sans-serif;font-weight:bold;font-size:12px;color:#9da0a4;background:#f5f5f5;padding:5px 12px;border:1px solid #ddd;border-radius:4px 0 4px 0;">'.htmlspecialchars($this->params['L_ABBC3_OFFTOPIC'],0).'</div><div class="offtopic_text" style="padding:5px 10px;color:#333333;">';$this->at($node);$this->out.='</div></div>';}elseif($tb===30){$this->out.='<pre class="abbc3_pre" style="display: block; font-family: monospace; white-space: pre;">';$this->at($node);$this->out.='</pre>';}else{if($this->params['STYLE_ID']==1||$this->params['STYLE_ID']==7||$this->params['STYLE_ID']==8){$this->out.='<blockquote';if(!$node->hasAttribute('author'))$this->out.=' class="uncited"';$this->out.='><div>';if($node->hasAttribute('author')){$this->out.='<cite>';if($node->hasAttribute('url'))$this->out.='<a href="'.htmlspecialchars($node->getAttribute('url'),2).'" class="postlink">'.htmlspecialchars($node->getAttribute('author'),0).'</a>';elseif($node->hasAttribute('profile_url'))$this->out.='<a href="'.htmlspecialchars($node->getAttribute('profile_url'),2).'">'.htmlspecialchars($node->getAttribute('author'),0).'</a>';else$this->out.=htmlspecialchars($node->getAttribute('author'),0);$this->out.=' '.htmlspecialchars($this->params['L_WROTE'].$this->params['L_COLON'],0);if($node->hasAttribute('post_url'))$this->out.=' <a href="'.htmlspecialchars($node->getAttribute('post_url'),2).'" data-post-id="'.htmlspecialchars($node->getAttribute('post_id'),2).'" onclick="if(document.getElementById(hash.substr(1)))href=hash">↑</a>';if($node->hasAttribute('date'))$this->out.='<div class="responsive-hide">'.htmlspecialchars($node->getAttribute('date'),0).'</div>';$this->out.='</cite>';}$this->at($node);}else{$this->out.='<blockquote class="uncited"><div>';$this->at($node);}$this->out.='</div></blockquote>';}elseif($tb===32){$this->out.='<span class="abbc3_strike" style="text-decoration: line-through">';$this->at($node);$this->out.='</span>';}elseif($tb===33){$this->out.='<span class="shadow" style="display: inline; padding: 0 6px; color: '.htmlspecialchars($node->getAttribute('shadow'),2).'; text-shadow: -2px 2px 2px #999;">';$this->at($node);$this->out.='</span>';}else{$this->out.='<span style="font-size: '.htmlspecialchars($node->getAttribute('size'),2);if($this->params['STYLE_ID']==7||$this->params['STYLE_ID']==8||$this->params['STYLE_ID']==9){$this->out.='%; line-height: normal">';$this->at($node);}else{$this->out.='%; line-height: 116%;">';$this->at($node);}$this->out.='</span>';}elseif($tb<41)if($tb<38)if($tb===35)$this->out.='<iframe width="100%" height="166" scrolling="no" frameborder="no" src="https://w.soundcloud.com/player/?url='.htmlspecialchars($node->getAttribute('content'),2).'&amp;color=ff5500&amp;auto_play=false&amp;hide_related=false&amp;show_comments=true&amp;show_user=true&amp;show_reposts=false"></iframe>';elseif($tb===36){$this->out.='<div class="spoilwrapper" style="margin:5px 0;font-weight:normal;padding:4px 10px;background-color:#fff;border:1px solid #dbdbdb;border-radius:4px;color:#333333;"><div class="spoiltitle" style="margin:0;padding:0;width:100%;"><span class="spoilbtn" style="margin:2px 5px;text-transform:uppercase;font-family:\'Helvetica Neue\', Helvetica, Arial, sans-serif;font-size:11px;font-weight:bold;display:block;cursor:pointer;color:#333;" data-show="'.htmlspecialchars($this->params['L_ABBC3_SPOILER_SHOW'],2).'" data-hide="'.htmlspecialchars($this->params['L_ABBC3_SPOILER_HIDE'],2).'">'.htmlspecialchars($this->params['L_ABBC3_SPOILER_SHOW'],0).'</span></div><div class="spoilcontent" style="color:#333333;display:none;padding:5px;border-top:1px solid #ccc;">';$this->at($node);$this->out.='</div></div>';}else$this->out.='<strike>'.htmlspecialchars($node->getAttribute('content'),0).'</strike>';elseif($tb===38){$this->out.='<sub style="vertical-align: sub; font-size: smaller;">';$this->at($node);$this->out.='</sub>';}elseif($tb===39){$this->out.='<sup style="vertical-align: super; font-size: smaller;">';$this->at($node);$this->out.='</sup>';}else{$this->out.='<span style="text-decoration: underline">';$this->at($node);$this->out.='</span>';}elseif($tb<44)if($tb===41){$this->out.='<a href="'.htmlspecialchars($node->getAttribute('url'),2).'" class="postlink">';$this->at($node);$this->out.='</a>';}elseif($tb===42)$this->out.='<a href="'.htmlspecialchars($node->getAttribute('content'),2).'" class="bbvideo" data-bbvideo="560,315">'.htmlspecialchars($node->getAttribute('content'),0).'</a>';else$this->out.='<br>';elseif($tb===44);else{$this->out.='<p>';$this->at($node);$this->out.='</p>';}
				}
	}
	private static $static=array('/ALIGN'=>'</span>','/BLINK'=>'</blink>','/BLUR'=>'</span>','/COLOR'=>'</span>','/COLOR2'=>'</div>','/DIR'=>'</bdo>','/DROPSHADOW'=>'</span>','/EMAIL'=>'</a>','/FADE'=>'</span>','/FLOAT'=>'</div>','/FONT'=>'</span>','/GLOW'=>'</span>','/HIDDEN'=>'<!-- ABBC3_BBCODE_HIDDEN -->','/HIGHLIGHT'=>'</span>','/LI'=>'</li>','/MARQ'=>'</marquee>','/MOD'=>'</td></tr></table>','/NFO'=>'</pre>','/OFFTOPIC'=>'</div></div>','/PRE'=>'</pre>','/S'=>'</span>','/SHADOW'=>'</span>','/SPOIL'=>'</div></div>','/SUB'=>'</sub>','/SUP'=>'</sup>','/U'=>'</span>','/URL'=>'</a>','BLINK'=>'<blink>','FADE'=>'<span class="fadeEffect">','HIDDEN'=>'<!-- ABBC3_BBCODE_HIDDEN -->','LI'=>'<li>','NFO'=>'<pre class="nfo" style="color: #000000; font-weight: normal; line-height: normal; font-size: 10pt; font-family: Terminal, monospace; background-color: #ffffff; white-space: pre; padding: 5px;">','PRE'=>'<pre class="abbc3_pre" style="display: block; font-family: monospace; white-space: pre;">','S'=>'<span class="abbc3_strike" style="text-decoration: line-through">','SUB'=>'<sub style="vertical-align: sub; font-size: smaller;">','SUP'=>'<sup style="vertical-align: super; font-size: smaller;">','U'=>'<span style="text-decoration: underline">');
	private static $dynamic=array('ALIGN'=>array('(^[^ ]+(?> (?!align=)[^=]+="[^"]*")*(?> align="([^"]*)")?.*)s','<span style="text-align:$1; display:block;">'),'BLUR'=>array('(^[^ ]+(?> (?!blur=)[^=]+="[^"]*")*(?> blur="([^"]*)")?.*)s','<span class="blur" style="display: inline; padding: 0 6px; color: transparent; text-shadow: 0 0 0.2em $1;">'),'COLOR'=>array('(^[^ ]+(?> (?!color=)[^=]+="[^"]*")*(?> color="([^"]*)")?.*)s','<span style="color: $1">'),'COLOR2'=>array('(^[^ ]+(?> (?!color2=)[^=]+="[^"]*")*(?> color2="([^"]*)")?.*)s','<div style="color: $1">'),'DIR'=>array('(^[^ ]+(?> (?!dir=)[^=]+="[^"]*")*(?> dir="([^"]*)")?.*)s','<bdo dir="$1">'),'DROPSHADOW'=>array('(^[^ ]+(?> (?!dropshadow=)[^=]+="[^"]*")*(?> dropshadow="([^"]*)")?.*)s','<span class="dropshadow" style="display: inline; padding: 0 6px; color: $1; text-shadow: -1px 1px 0 #999;">'),'FLOAT'=>array('(^[^ ]+(?> (?!float=)[^=]+="[^"]*")*(?> float="([^"]*)")?.*)s','<div style="float:$1; padding:0 10px;">'),'FONT'=>array('(^[^ ]+(?> (?!font=)[^=]+="[^"]*")*(?> font="([^"]*)")?.*)s','<span style="font-family: $1;">'),'GLOW'=>array('(^[^ ]+(?> (?!glow=)[^=]+="[^"]*")*(?> glow="([^"]*)")?.*)s','<span class="glow" style="display: inline; padding: 0 6px; color: #ffffff; text-shadow: 0 0 1em $1, 0 0 1em $1, 0 0 1.2em $1;">'),'HIGHLIGHT'=>array('(^[^ ]+(?> (?!highlight=)[^=]+="[^"]*")*(?> highlight="([^"]*)")?.*)s','<span style="background-color: $1;">'),'MARQ'=>array('(^[^ ]+(?> (?!marq=)[^=]+="[^"]*")*(?> marq="([^"]*)")?.*)s','<marquee class="abbc3_marquee" direction="$1" scrolldelay="100" onmouseover="this.scrollDelay=10000000;" onmouseout="this.scrollDelay=100;" style="margin: 10px 0; padding: 5px; display: inline-block;">'),'SHADOW'=>array('(^[^ ]+(?> (?!shadow=)[^=]+="[^"]*")*(?> shadow="([^"]*)")?.*)s','<span class="shadow" style="display: inline; padding: 0 6px; color: $1; text-shadow: -2px 2px 2px #999;">'),'SOUNDCLOUD'=>array('(^[^ ]+(?> (?!content=)[^=]+="[^"]*")*(?> content="([^"]*)")?.*)s','<iframe width="100%" height="166" scrolling="no" frameborder="no" src="https://w.soundcloud.com/player/?url=$1&amp;color=ff5500&amp;auto_play=false&amp;hide_related=false&amp;show_comments=true&amp;show_user=true&amp;show_reposts=false"></iframe>'),'URL'=>array('(^[^ ]+(?> (?!url=)[^=]+="[^"]*")*(?> url="([^"]*)")?.*)s','<a href="$1" class="postlink">'));
	private static $attributes;
	private static $quickBranches=array('/B'=>0,'/CODE'=>1,'/I'=>2,'/LIST'=>3,'/QUOTE'=>4,'/SIZE'=>5,'ATTACHMENT'=>6,'B'=>7,'BBVIDEO'=>8,'CODE'=>9,'E'=>10,'EMAIL'=>11,'EMOJI'=>12,'I'=>13,'LINK_TEXT'=>14,'LIST'=>15,'MOD'=>16,'OFFTOPIC'=>17,'QUOTE'=>18,'SIZE'=>19,'SPOIL'=>20,'STRIKE'=>21,'YOUTUBE'=>22);
	public $quickRenderingTest='(<(?=[FI])(?>FLASH|IMG)[ />])';

	protected function renderQuick($xml)
	{
		$xml = $this->decodeSMP($xml);
		self::$attributes = array();
		$html = preg_replace_callback(
			'(<(?:(?!/)((?:ATTACHMENT|BBVIDEO|E(?>MOJI)?|LINK_TEXT|S(?>OUNDCLOUD|TRIKE)|YOUTUBE))(?: [^>]*)?>.*?</\\1|(/?(?!br/|p>)[^ />]+)[^>]*?(/)?)>)s',
			array($this, 'quick'),
			preg_replace(
				'(<[eis]>[^<]*</[eis]>)',
				'',
				substr($xml, 1 + strpos($xml, '>'), -4)
			)
		);

		return str_replace('<br/>', '<br>', $html);
	}

	protected function quick($m)
	{
		if (isset($m[2]))
		{
			$id = $m[2];

			if (isset($m[3]))
			{
				unset($m[3]);

				$m[0] = substr($m[0], 0, -2) . '>';
				$html = $this->quick($m);

				$m[0] = '</' . $id . '>';
				$m[2] = '/' . $id;
				$html .= $this->quick($m);

				return $html;
			}
		}
		else
		{
			$id = $m[1];

			$lpos = 1 + strpos($m[0], '>');
			$rpos = strrpos($m[0], '<');
			$textContent = substr($m[0], $lpos, $rpos - $lpos);

			if (strpos($textContent, '<') !== false)
				throw new \RuntimeException;

			$textContent = htmlspecialchars_decode($textContent);
		}

		if (isset(self::$static[$id]))
			return self::$static[$id];

		if (isset(self::$dynamic[$id]))
		{
			list($match, $replace) = self::$dynamic[$id];
			return preg_replace($match, $replace, $m[0], 1);
		}

		if (!isset(self::$quickBranches[$id]))
		{
			if ($id[0] === '!' || $id[0] === '?' || preg_match('(^/?(?>FLASH|IMG)$)', $id))
				throw new \RuntimeException;
			return '';
		}

		$attributes = array();
		if (strpos($m[0], '="') !== false)
		{
			preg_match_all('(([^ =]++)="([^"]*))S', substr($m[0], 0, strpos($m[0], '>')), $matches);
			foreach ($matches[1] as $i => $attrName)
				$attributes[$attrName] = $matches[2][$i];
		}

		$qb = self::$quickBranches[$id];
		if($qb<12){if($qb<6)if($qb<3)if($qb===0){$html='';if($this->params['STYLE_ID']==7||$this->params['STYLE_ID']==8||$this->params['STYLE_ID']==9)$html.='</strong>';else$html.='</span>';}elseif($qb===1){$html='';if($this->params['STYLE_ID']==1||$this->params['STYLE_ID']==7||$this->params['STYLE_ID']==8)$html.='</code></pre>';else$html.='</code>';$html.='</div>';}else{$html='';if($this->params['STYLE_ID']==7||$this->params['STYLE_ID']==8||$this->params['STYLE_ID']==9)$html.='</em>';else$html.='</span>';}elseif($qb===3){$attributes=array_pop(self::$attributes);$html='';if(!isset($attributes['type']))$html.='</ul>';elseif((strpos('upperlowerdecim',mb_substr(htmlspecialchars_decode($attributes['type']),0,5,'utf-8'))!==false))$html.='</ol>';else$html.='</ul>';}elseif($qb===4){$html='';if($this->params['STYLE_ID']==1||$this->params['STYLE_ID']==7||$this->params['STYLE_ID']==8);else;$html.='</div></blockquote>';}else{$html='';if($this->params['STYLE_ID']==7||$this->params['STYLE_ID']==8||$this->params['STYLE_ID']==9);else;$html.='</span>';}elseif($qb<9)if($qb===6){$attributes+=array('index'=>null,'filename'=>null);$html='<div class="inline-attachment"><!-- ia'.str_replace('&quot;','"',$attributes['index']).' -->'.str_replace('&quot;','"',$attributes['filename']).'<!-- ia'.str_replace('&quot;','"',$attributes['index']).' --></div>';}elseif($qb===7){$html='';if($this->params['STYLE_ID']==7||$this->params['STYLE_ID']==8||$this->params['STYLE_ID']==9)$html.='<strong>';else$html.='<span style="font-weight: bold">';}else{$attributes+=array('content'=>null,'bbvideo0'=>null,'bbvideo1'=>null);$html='<a href="'.$attributes['content'].'" class="bbvideo" data-bbvideo="'.$attributes['bbvideo0'].','.$attributes['bbvideo1'].'" target="_blank" rel="noreferrer">'.str_replace('&quot;','"',$attributes['content']).'</a>';}elseif($qb===9){$html='<div class="codebox"><p>'.htmlspecialchars($this->params['L_CODE'].$this->params['L_COLON'],0).' <a href="#" onclick="selectCode(this); return false;">'.htmlspecialchars($this->params['L_SELECT_ALL_CODE'],0).'</a></p>';if($this->params['STYLE_ID']==1||$this->params['STYLE_ID']==7||$this->params['STYLE_ID']==8)$html.='<pre><code>';else$html.='<code>';}elseif($qb===10){$html='';if(empty($this->params['S_VIEWSMILIES']))$html.=htmlspecialchars($textContent,0);elseif(isset(self::$btA66C2C3F[$textContent])){$n=self::$btA66C2C3F[$textContent];$html.='<img class="smilies" src="'.htmlspecialchars($this->params['T_SMILIES_PATH'],2);if($n<21)if($n<11)if($n<6)if($n<3)if($n===0)$html.='/icon_cool.gif" width="15" height="17" alt="8-)" title="Cool">';elseif($n===1)$html.='/icon_exclaim.gif" width="15" height="17" alt=":!:" title="Exclamation">';else$html.='/icon_e_sad.gif" width="15" height="17" alt=":(" title="Sad">';elseif($n===3)$html.='/icon_e_smile.gif" width="15" height="17" alt=":)" title="Smile">';elseif($n===4)$html.='/icon_e_sad.gif" width="15" height="17" alt=":-(" title="Sad">';else$html.='/icon_e_smile.gif" width="15" height="17" alt=":-)" title="Smile">';elseif($n<9)if($n===6)$html.='/icon_e_confused.gif" width="15" height="17" alt=":-?" title="Confused">';elseif($n===7)$html.='/icon_e_biggrin.gif" width="15" height="17" alt=":-D" title="Very Happy">';else$html.='/icon_razz.gif" width="15" height="17" alt=":-P" title="Razz">';elseif($n===9)$html.='/icon_e_surprised.gif" width="15" height="17" alt=":-o" title="Surprised">';else$html.='/icon_mad.gif" width="15" height="17" alt=":-x" title="Mad">';elseif($n<16)if($n<14)if($n===11)$html.='/icon_neutral.gif" width="15" height="17" alt=":-|" title="Neutral">';elseif($n===12)$html.='/icon_e_confused.gif" width="15" height="17" alt=":?" title="Confused">';else$html.='/icon_question.gif" width="15" height="17" alt=":?:" title="Question">';elseif($n===14)$html.='/icon_e_confused.gif" width="15" height="17" alt=":???:" title="Confused">';else$html.='/icon_e_biggrin.gif" width="15" height="17" alt=":D" title="Very Happy">';elseif($n<19)if($n===16)$html.='/icon_razz.gif" width="15" height="17" alt=":P" title="Razz">';elseif($n===17)$html.='/icon_arrow.gif" width="15" height="17" alt=":arrow:" title="Arrow">';else$html.='/icon_cool.gif" width="15" height="17" alt=":cool:" title="Cool">';elseif($n===19)$html.='/icon_cry.gif" width="15" height="17" alt=":cry:" title="Crying or Very Sad">';else$html.='/icon_e_surprised.gif" width="15" height="17" alt=":eek:" title="Surprised">';elseif($n<32)if($n<27)if($n<24)if($n===21)$html.='/icon_evil.gif" width="15" height="17" alt=":evil:" title="Evil or Very Mad">';elseif($n===22)$html.='/icon_e_geek.gif" width="17" height="17" alt=":geek:" title="Geek">';else$html.='/icon_e_biggrin.gif" width="15" height="17" alt=":grin:" title="Very Happy">';elseif($n===24)$html.='/icon_idea.gif" width="15" height="17" alt=":idea:" title="Idea">';elseif($n===25)$html.='/icon_lol.gif" width="15" height="17" alt=":lol:" title="Laughing">';else$html.='/icon_mad.gif" width="15" height="17" alt=":mad:" title="Mad">';elseif($n<30)if($n===27)$html.='/icon_mrgreen.gif" width="15" height="17" alt=":mrgreen:" title="Mr. Green">';elseif($n===28)$html.='/icon_e_surprised.gif" width="15" height="17" alt=":o" title="Surprised">';else$html.='/icon_redface.gif" width="15" height="17" alt=":oops:" title="Embarrassed">';elseif($n===30)$html.='/icon_razz.gif" width="15" height="17" alt=":razz:" title="Razz">';else$html.='/icon_rolleyes.gif" width="15" height="17" alt=":roll:" title="Rolling Eyes">';elseif($n<37)if($n<35)if($n===32)$html.='/icon_e_sad.gif" width="15" height="17" alt=":sad:" title="Sad">';elseif($n===33)$html.='/icon_eek.gif" width="15" height="17" alt=":shock:" title="Shocked">';else$html.='/icon_e_smile.gif" width="15" height="17" alt=":smile:" title="Smile">';elseif($n===35)$html.='/icon_twisted.gif" width="15" height="17" alt=":twisted:" title="Twisted Evil">';else$html.='/icon_e_ugeek.gif" width="17" height="18" alt=":ugeek:" title="Uber Geek">';elseif($n<40)if($n===37)$html.='/icon_e_wink.gif" width="15" height="17" alt=":wink:" title="Wink">';elseif($n===38)$html.='/icon_mad.gif" width="15" height="17" alt=":x" title="Mad">';else$html.='/icon_neutral.gif" width="15" height="17" alt=":|" title="Neutral">';elseif($n===40)$html.='/icon_e_wink.gif" width="15" height="17" alt=";)" title="Wink">';else$html.='/icon_e_wink.gif" width="15" height="17" alt=";-)" title="Wink">';}else$html.=htmlspecialchars($textContent,0);}else{$attributes+=array('email'=>null,'body'=>null);$html='<a href="mailto:'.$attributes['email'];if(isset($attributes['subject'])||isset($attributes['body'])){$html.='?';if(isset($attributes['subject']))$html.='subject='.$attributes['subject'];if(isset($attributes['body'])){if(isset($attributes['subject']))$html.='&amp;';$html.='body='.$attributes['body'];}}$html.='">';}}elseif($qb<18)if($qb<15)if($qb===12){$attributes+=array('seq'=>null);$html='';if(!empty($this->params['S_VIEWSMILIES']))$html.='<img alt="'.htmlspecialchars($textContent,2).'" class="emoji smilies" draggable="false" src="//cdn.jsdelivr.net/emojione/assets/svg/'.$attributes['seq'].'.svg">';else$html.=htmlspecialchars($textContent,0);}elseif($qb===13){$html='';if($this->params['STYLE_ID']==7||$this->params['STYLE_ID']==8||$this->params['STYLE_ID']==9)$html.='<em>';else$html.='<span style="font-style: italic">';}else{$attributes+=array('text'=>null);$html=str_replace('&quot;','"',$attributes['text']);}elseif($qb===15){$attributes+=array('type'=>null);$html='';if(!isset($attributes['type']))$html.='<ul>';elseif((strpos('upperlowerdecim',mb_substr(htmlspecialchars_decode($attributes['type']),0,5,'utf-8'))!==false))$html.='<ol style="list-style-type: '.$attributes['type'].'">';else$html.='<ul style="list-style-type: '.$attributes['type'].'">';self::$attributes[]=$attributes;}elseif($qb===16){$attributes+=array('mod'=>null);$html='<table class="ModTable" style="background-color:#FFFFFF;border:1px solid #000000;border-collapse:separate;border-spacing:5px;padding:0;width:100%;color:#333333;overflow:hidden;"><tr><td class="exclamation" rowspan="2" style="background-color:#ff6060;font-weight:bold;font-family:\'Times New Roman\',Verdana,sans-serif;font-size:4em;color:#ffffff;vertical-align:middle;text-align:center;width:1%;"> ! </td><td class="rowuser" style="border-bottom:1px solid #000000;font-weight:bold;">'.htmlspecialchars($this->params['L_MESSAGE'],0).' '.htmlspecialchars($this->params['L_FROM'].$this->params['L_COLON'],0).' '.str_replace('&quot;','"',$attributes['mod']).'</td></tr><tr><td class="rowtext">';}else$html='<div class="offtopic" style="position:relative;margin:5px 0;padding:39px 19px 14px;background:#fff;border:1px solid #ddd;border-radius:4px;"><div class="offtopic_title" style="position:absolute;top:-1px;left:-1px;font-family:\'Helvetica Neue\', Helvetica, Arial, sans-serif;font-weight:bold;font-size:12px;color:#9da0a4;background:#f5f5f5;padding:5px 12px;border:1px solid #ddd;border-radius:4px 0 4px 0;">'.htmlspecialchars($this->params['L_ABBC3_OFFTOPIC'],0).'</div><div class="offtopic_text" style="padding:5px 10px;color:#333333;">';elseif($qb<21)if($qb===18){$attributes+=array('url'=>null,'author'=>null,'post_id'=>null);$html='';if($this->params['STYLE_ID']==1||$this->params['STYLE_ID']==7||$this->params['STYLE_ID']==8){$html.='<blockquote';if(!isset($attributes['author']))$html.=' class="uncited"';$html.='><div>';if(isset($attributes['author'])){$html.='<cite>';if(isset($attributes['url']))$html.='<a href="'.$attributes['url'].'" class="postlink">'.str_replace('&quot;','"',$attributes['author']).'</a>';elseif(isset($attributes['profile_url']))$html.='<a href="'.$attributes['profile_url'].'">'.str_replace('&quot;','"',$attributes['author']).'</a>';else$html.=str_replace('&quot;','"',$attributes['author']);$html.=' '.htmlspecialchars($this->params['L_WROTE'].$this->params['L_COLON'],0);if(isset($attributes['post_url']))$html.=' <a href="'.$attributes['post_url'].'" data-post-id="'.$attributes['post_id'].'" onclick="if(document.getElementById(hash.substr(1)))href=hash">↑</a>';if(isset($attributes['date']))$html.='<div class="responsive-hide">'.str_replace('&quot;','"',$attributes['date']).'</div>';$html.='</cite>';}}else$html.='<blockquote class="uncited"><div>';}elseif($qb===19){$attributes+=array('size'=>null);$html='<span style="font-size: '.$attributes['size'];if($this->params['STYLE_ID']==7||$this->params['STYLE_ID']==8||$this->params['STYLE_ID']==9)$html.='%; line-height: normal">';else$html.='%; line-height: 116%;">';}else$html='<div class="spoilwrapper" style="margin:5px 0;font-weight:normal;padding:4px 10px;background-color:#fff;border:1px solid #dbdbdb;border-radius:4px;color:#333333;"><div class="spoiltitle" style="margin:0;padding:0;width:100%;"><span class="spoilbtn" style="margin:2px 5px;text-transform:uppercase;font-family:\'Helvetica Neue\', Helvetica, Arial, sans-serif;font-size:11px;font-weight:bold;display:block;cursor:pointer;color:#333;" data-show="'.htmlspecialchars($this->params['L_ABBC3_SPOILER_SHOW'],2).'" data-hide="'.htmlspecialchars($this->params['L_ABBC3_SPOILER_HIDE'],2).'">'.htmlspecialchars($this->params['L_ABBC3_SPOILER_SHOW'],0).'</span></div><div class="spoilcontent" style="color:#333333;display:none;padding:5px;border-top:1px solid #ccc;">';elseif($qb===21){$attributes+=array('content'=>null);$html='<strike>'.str_replace('&quot;','"',$attributes['content']).'</strike>';}else{$attributes+=array('content'=>null);$html='<a href="'.$attributes['content'].'" class="bbvideo" data-bbvideo="560,315">'.str_replace('&quot;','"',$attributes['content']).'</a>';}

		return $html;
	}
}