Name:		Code Parser
Datum:		19-05-2011
Version: 	V1.2

Ein Gemeinschaftsprojekt der folgenden Seiten:
---------------------------------------------------------------------------------------------------
Author:		Dooki
Homepage:	http://www.kitnetwork.de/
---------------------------------------------------------------------------------------------------
Author: 	Crack
Homepage:	www.kit-coding.de
Email: 		webadmin@kit-coding.de
---------------------------------------------------------------------------------------------------
Author:		Reddevil
Homepage:	http://www.saarradio.de/
---------------------------------------------------------------------------------------------------
Author:		ESA-Lucky
Homepage:	http://www.esa-clan.de/

---------------------------------------------------------------------------------------------------
INSTALL HowTo Code Parser
---------------------------------------------------------------------------------------------------
 
1. Lade alle Ordner unter Beibehaltung der Ordnerstruktur hoch (Auer der Anleitung.txt). Dabei werden keine Dateien berschrieben ;)
2. ndere nun folgende 6 Dateien (Bei einem Update nur die mit einem *** gekennzeichnet sind):

		/pkinc/cfg/bbcode.php
***		/pkinc/class/bbcode.php
		/pkinc/publictpl/format_text.htm
		/pkinc/admintpl/format_text.htm
		/Adminbereich -> Konfiguration -> Meta-Angaben -> Eigene Headerangaben
		/pkinc/admintpl/site.htm

=======================================================================

/pkinc/cfg/bbcode.php

Suche:

array(
	'tag'	=> 'code',
	'html'	=> '<code>{text}</code>',
	'type'	=> '',#empty=default
	),

Ersetze es mit:

#Code Parser der KNW Community ANFANG
/*
array(
	'tag'	=> 'code',
	'html'	=> '<code>{text}</code>',
	'type'	=> '',#empty=default
	),
*/
array(
	'tag'	=> 'code',
	'html'	=> '{text}',
	'type'	=> 'parser',#empty=default
	),
array(
	'tag'	=> 'php',
	'html'	=> '{text}',
	'type'	=> 'parser',#empty=default
	),
#Code Parser der KNW Community ENDE

=======================================================================

/pkinc/class/bbcode.php

Suche:

var $urlwidth2=-10;

Fge darunter ein:

	#Code Parser der KNW Community ANFANG
	var $codecount=0;
	var $phpcodecount=1;
	#Code Parser der KNW Community ENDE

Suche weiter:

case 'url' :
	$func = 'replace_url';

	$pattern = "#\[(".$code['tag'].")\](.*)\[/\\1\]#eisuSU"; #format: [url]link[/url]
	$text = preg_replace($pattern,"\$this->$func('$code[html]','\\2')",$text);

	$pattern = "#\[(".$code['tag'].")=(.*)\](.*)\[/\\1\]#eisuSU"; #format [url=link]text[/url]
	$text = preg_replace($pattern,"\$this->$func('$code[html]','\\2','\\3')",$text);					
			
	break; #END case url

Fge darunter ein:
				#Code Parser der KNW Community ANFANG
				case 'parser' :
					$func = 'highlight_phpcode';

					$pattern = "#\[(".$code['tag'].")\](.*)\[/\\1\]#eisuSU";
					$text = preg_replace($pattern,"\$this->$func('\\2','\\1')",$text);
					
					break;
				#Code Parser der KNW Community ENDE

Suche weiter:

else
				{
				$replace = str_repeat($replacer,$len);
				
				$this->text = eregi_replace($badword,$replace,$this->text);
				}
			}#END foreach
		}
	#@END Method: textcensor

Fge darunter ein:

		#Code Parser der KNW Community ANFANG
		function highlight_phpcode($code,$tag){		
			if(strtolower($tag)=='php'){
				$headlineS='PHP-Code Anfang:';
				$headlineE='PHP-Code ENDE:';
				$DivbgColor='FFF';	
				$DivTextColor='000';
				$BorderColorDiv='FF7F00';
				$TextColorHeadlines='FF7F00';				
			}else{
				ini_set('highlight.comment','#FFFFFF');
				ini_set('highlight.default','#FFFFFF');
				ini_set('highlight.keyword','#FF7F00');
				ini_set('highlight.string','#FF3333');
				ini_set('highlight.html','#FFFFFF');
				$headlineS='Shell Code Anfang:';
				$headlineE='Shell ENDE:';
				$DivbgColor='030303';
				$DivTextColor='fff';
				$BorderColorDiv='FFF';
				$TextColorHeadlines='FF3333';
			}
			
			#Config

			$CounterColor='FFF';
			$LinkColor='FFF';
			$trans = get_html_translation_table(HTML_ENTITIES);
			$code  = 	
							strtr(
							strip_tags(
							    str_replace("&amp;","&",
								str_replace("&#36;","$",
								str_replace("&#40;","(",
								str_replace("&#41;",")",
								str_replace("&#91;","[",
								str_replace("&#93;","]",
								str_replace("&#039;",chr(39),
								str_replace('\n',"<br />",
								str_replace("[url]","",
								str_replace("[/url]","",
								str_replace("SCRIPT","TPIRCS",
								str_replace("script","tpircs",
								$code))))))))))))),
							array_flip($trans));
							
			#Convert Special Characters
			$code = utf8_encode($code); #Umlaut Fix 1.6.5
			$CodeToVisible=highlight_string("<?php\n".$code."\n?>",TRUE);
			$CodeToVisible2 = explode('<br />', $CodeToVisible);
			$xy = sizeof($CodeToVisible2)-2;
			$textwidth = "95%";#Gre des Code Feldes unter Einbeziehung der Navigationen
			
			$textsmallwidth = "30";
			$textsmallheight = "12";
			$countReal=1;
			for($x=1; $x <= $xy; $x++) {
				if(trim($CodeToVisible2[$x]) != '') {	
					$phpcodecount=$this->phpcodecount++;				
					if($x <> $xy) {					
						$text_zeilen .= ''.$countReal.'&nbsp;<br />';
						$text_code .= ''.$CodeToVisible2[$x].'<br />';
					} else {
						$text_zeilen .= ''.$countReal.'&nbsp;';
						$text_code .= $CodeToVisible2[$x];
					}
					$countReal++;# Nur Zhlen wenn Zeile nicht leer Keine -> \n\t\r enthalten
				}else{
					$codecount++;
				}
			}
			$xy=$xy-$codecount; # Nur echte Zeilen berechnen :)
			$xy==1 ? $Lines='Zeile' : $Lines='Zeilen';
			$textheight = $xy*$textsmallheight; #Hhe des Div Containers
			$textheight2 = $textheight+20;#Hhe des Div Containers + 20px wegen Scrollleiste
			$textwidth2 = $textwidth-$textsmallwidth-6; # -2px wegen schnerer Darstellung
			$styleart1 = 'background-color: #'.$DivbgColor.'; font-size: 12px; font-family: Arial,Helvetica,sans-serif;line-height:12px;';
			$styleart2 = 'font-size: 12px; font-family: Arial,Helvetica,sans-serif;line-height:12px;';
			$text  = '<table class="contentbody" border="0" width="'.$textwidth.'" cellpadding="2" cellspacing="3" align="center">';
			$text .= ' <tr>';
			$text .= '  <td class="highlight" width="100%">';
			$text .= '   <table style="table-layout: fixed;" border="0" width="100%" cellpadding="0" cellspacing="1" align="center" class="contentbody">';
			$text .= '    <tr>';
			$text .= '     <td style="font-size:12px;vertical-align:middle;" height="21" width="5%" align="center" class="heads">';
			$text .= '      <img src="'.pkDIRWWWROOT.'fx/default/bbcode/'.strtolower($tag).'.png" alt="'.strtoupper($tag).' Icon" title="'.strtoupper($tag).' Icon" />';
			$text .= '     </td>';
			$text .= '     <td class="heads" style="font-size:12px;vertical-align:middle;" width="95%">';
			$text .= '      <span style="color:#'.$TextColorHeadlines.';"><b>'.$headlineS.'</b></span> <span style="color:#'.$LinkColor.';">(<b>'.$xy.'</b> '.$Lines.') | </span><a style="cursor: pointer;color:#'.$LinkColor.';" class="small" title="Code markieren" onclick="select_div_all(\'phpcode'.$phpcodecount.'\');"><b>Code markieren</b></a>';
			$text .= '     </td>';
			$text .= '    </tr>';
			$text .= '    <tr>';
			$text .= '     <td width="5%" style="vertical-align:top;">';
			$text .= '      <table border="0" width="100%" cellpadding="0" cellspacing="0">';
			$text .= '       <tr>';
			$text .= '        <td style="'.$styleart2.'width: 5%;border-top:1px solid #'.$BorderColorDiv.';vertical-align:top;" align="right" nowrap="nowrap" class="highlight">';
			$text .= '         <span style="color:#'.$CounterColor.';">';
			$text .= 			$text_zeilen;
			$text .= ' 		   </span>';
			$text .= '        </td>';
			$text .= '       </tr>';
			$text .= '      </table>';
			$text .= '     </td>';
			$text .= '     <td style="'.$styleart1.'background-color: #'.$DivbgColor.';padding-right:2px;vertical-align:top;" width="95%">';
			$text .= '      <div style="overflow: auto; width: 100%; height: '.$textheight2.'px; border: 1px solid #'.$BorderColorDiv.';">';
			$text .= '       <div style="width:95%;" id="phpcode'.$phpcodecount.'">';
			$text .= '        <span style="color: #'.$DivTextColor.';">';
								$text_code = preg_replace("/\r/","",$text_code);
								$text_code = preg_replace("/^<\/font>/","",$text_code);
								if(!preg_match("/<\/font>$/",$text_code)) $text_code .= '</font>';
								$text_code = str_replace("<font","<span",$text_code);
								$text_code = str_replace("</font>","</span>",$text_code);
								$text_code = str_replace("color&#58;","color:",$text_code);
								$text_code = str_replace('tpircs',"script",$text_code);
								$text_code = str_replace('TPIRCS',"SCRIPT",$text_code);
								$text .= $text_code;
			$text .= '  	 </div>';
			$text .= '      </div>';
			$text .= ' 	   </td>';
			$text .= ' 	  </tr>';
			$text .= ' 	  <tr>';
			$text .= ' 	   <td class="heads" height="21" width="5%">&nbsp;</td>';
			$text .= ' 	   <td class="heads" width="95%" style="font-size:12px;vertical-align:middle;" align="right">';
			$text .= '		<span style="color:#'.$TextColorHeadlines.';"><b>'.$headlineE.'</b></span> <span style="color:#'.$LinkColor.';">(<b>'.$xy.'</b> '.$Lines.') | </span><a style="cursor: pointer;color:#'.$LinkColor.';" class="small" title="Code markieren" onclick="select_div_all(\'phpcode'.$phpcodecount.'\');"><b>Code markieren</b></a>&nbsp;';
			$text .= ' 	   </td>';
			$text .= ' 	  </tr>';
			$text .= ' 	 </table>';
			$text .= '  </td>';
			$text .= ' </tr>';
			$text .= '</table>';
			$text = str_replace('valign="top" nowrap="nowrap">&nbsp;</span>','valign="top" nowrap="nowrap">',$text);
			$text = str_replace('</span></span>','</span>',$text);
			$pattern = "/COLOR\=\"\#(.*)\"/esiU";
			while (preg_match($pattern,$text)) {
				$text=preg_replace($pattern,"\$this->color2style('\\1')",$text);
			}
			return $text;
		}

		function color2style($font_code) {
			return 'style="color: #'.$font_code.';'.$styleart.'"';
		}
		#Code Parser der KNW Community ENDE


=======================================================================

pkinc/publictpl/format_text.htm

Suche:

<td><a href="javascript:;" onclick="pkBBCode('CODE');" onfocus="blur();"><img src="fx/default/bbcode/code.gif" alt="Code" /></a></td>

Fge darunter ein:

<!-- Code Parser der KNW Community -->
<td><a href="javascript:;" onclick="pkBBCode('PHP');" onfocus="blur();"><img src="fx/default/bbcode/php.gif" alt="PHP Code" /></a></td>
<!-- Code Parser der KNW Community -->

=======================================================================

pkinc/admintpl/format_text.htm

Suche:

<td><a href="javascript:;" onclick="pkBBCode('CODE');" onfocus="blur();"><img src="./../fx/default/bbcode/code.gif" alt="Code" /></a></td>

Fge darunter ein:

<!-- Code Parser der KNW Community -->
<td><a href="javascript:;" onclick="pkBBCode('PHP');" onfocus="blur();"><img src="./../fx/default/bbcode/php.gif" alt="PHP Code" /></a></td>
<!-- Code Parser der KNW Community -->

=======================================================================

Adminbereich -> Konfiguration -> Meta-Angaben -> Eigene Headerangaben

Fgen Sie in die erste Zeile folgendes ein:

<!-- Code Parser der KNW Community -->
<script type="text/javascript" src="fx/div.js"></script>
<!-- Code Parser der KNW Community -->

=======================================================================

pkinc/admintpl/site.htm

Suche:

$site_refresh

Fge darunter ein:

<!-- Code Parser der KNW Community -->
<script type="text/javascript" src="fx/div.js"></script>
<!-- Code Parser der KNW Community -->

=======================================================================

Das war es auch schon.

Juhu


Support:
============================

Support & Fragen: 

Support gebe ich gerne im FORUM unter www.kit-coding.de 
PNS oder ICQ werden gnadenlos ignoriert!!!
