<?php
/**
 *	@filesource 	class_D.inc.php
 *
 * @category losp
 * @copyright Copyright by mensch.coop e.G. 2009
 * @mailto	dev [at] mensch.coop
 * @version 0.4.200901
 * @link http://mensch.coop
 */


/**
 * Klasse ist für Ausgaben zuständig die
 * 	a) nur für die Entwicklung relevant sind, also nicht für das Live System
 *  b) umgeleitet werden können, also nicht einfach nur ausgegeben werden, sondern in eine extra Datei
 */
class D {

	const ALL = 'ALL';
	
	private static $echo_count = 0;
	public static $echo_lines = array();

	private static function html2text($param_htmlstring) {

		$html_elements = array();
		$text_elements = array();

		foreach(mcCONST::$HTMLTAGS2TEXT as $htmlstags => $stringels) {
			$html_elements[] = $htmlstags;
			$text_elements[] = $stringels;
		}

//		$param_htmlstring = str_replace(mcCONST::LINEBREAK, '', $param_htmlstring);

		$textstring = str_replace($html_elements, $text_elements, $param_htmlstring);
		
		
		$textstring = strip_tags($textstring);
		
		return $textstring;
	}


	public static function e($param_string, $param_print=true, $param_force=false) {
		self::new_echo($param_string, $param_print, $param_force);
	}

	public static function printToFile($param_filename, $param_kindof = null) {

		global $__mc_D_LOGFILE_ONLY_USER;


		if($param_filename && !empty(self::$echo_lines)) {
			$file_content = '';
			foreach(self::$echo_lines as $line_nr => $line) {
				
				if($__mc_D_LOGFILE_ONLY_USER === $line['print'] || D::ALL ===$line['print']) {
					$file_content .= $line_nr.':'.mcCONST::TAB.self::html2text($line['line']).mcCONST::LINEBREAK;
				}
			}
			
			mcFile::write($param_filename, $file_content, $param_kindof);
		}
	}

	public static function printToScreen($param_return=false) {

		global $__mc_D_LOGFILE_ONLY_USER;
		
		if(!empty(self::$echo_lines)) {
			$screen_content = '<br /><br /><br />';
			foreach(self::$echo_lines as $line_nr => $line) {
//				echo '$__mc_D_LOGFILE_ONLY_USER = '.$__mc_D_LOGFILE_ONLY_USER.' == '.$line['print'].'<br/>';
//				if($__mc_D_LOGFILE_ONLY_USER === $line['print']) {
					$screen_content .= $line['line'];
//				}
				
			}
			if($param_return) {
				return $screen_content;
			} else {
				echo $screen_content;
			}
			
		}
	}

	
	public static function printToHtmlFile($param_filename, $param_kindof = 'w') {

		$screen_content = D::printToScreen(true);
		mcFile::write($param_filename, $screen_content, $param_kindof);
	}
	
	
	public static function printPDOQuery($param_query, array $param_bindValueArray=null, $param_print=true, $param_force=false) {
//		$return = '';

		foreach($param_bindValueArray as $string => $value) {
			$param_query = str_replace($string, $value, $param_query);
		}
//		D::li(highlight_string($param_query, true));
		D::li($param_query, $param_print, $param_force);
		D::show($param_bindValueArray, $param_query);
	}

	private static function new_echo($param_string, $param_print=true, $param_force=false) {


		if(trim($param_string)) {
//			if($param_htmlentities)
//				$param_string=htmlentities($param_string);
			self::$echo_lines[self::$echo_count] = array(
				'line'	=> $param_string,
				'print' => $param_print,
				'force' => $param_force
			);
			if($param_force) {
//				echo 'FORCE:'.mcCONST::TAB.$param_string;
				echo 'FORCE:'.mcCONST::TAB.$param_string.'<br/>';
			}
//			echo $param_string;
			self::$echo_count++;
		}
	}

	/**
	 * function htmlencode a string or array values () 
	 * 
	 * @param array/string $param_val
	 */
	public static function htmlencode_arrayvalues($param_val){
		if(is_array($param_val)){
			foreach($param_val as $key => $value){
				$param_val[$key]=self::htmlencode_arrayvalues($value);
			};
			return $param_val;
		}
		return htmlentities($param_val);
	}
	/**
	 * Funktion zeigt ein Objekt/Array html strukturiert an
	 *	anstelle von var_dump
	 */
	public static function show($param_val, $param_string="", $param_print=true, $param_force=false, $param_htmlentities=false) {

		if(is_array($param_string)) {
			$param_string = $param_string[0];
			$print_fullobject = $param_val;
                        
		}
		
//		self::new_echo("<br>______________________<br>", $param_print, $param_force);

		self::printCurrentFunction($param_print,"<br>______________________<br>");

//		self::new_echo("<b>show(".$param_string.")</b>", $param_print, $param_force);
		$string_show = "<br /><b>show(".$param_string.")</b><br />";

		if(is_object($param_val) && get_class($param_val)=='DOMElement') {
			D::showdomelement($param_val, $string_show.$param_string,$param_print, $param_force);
		} else {
			if(is_array($param_val)) {
				$string_show .= "count(".$param_val.") = ".count($param_val)."";
//				self::new_echo("<br/>count(".$param_val.") = ".count($param_val)."", $param_print, $param_force);
			} else if(is_object($param_val)) {
				$objvars = get_object_vars($param_val);
				sort($objvars);
				$objfncs = get_class_methods(get_class($param_val));
				sort($objfncs);
				
				$parent = get_parent_class($param_val);
				while($parent) {
					$parents .= ' extends <b>'.$parent.'</b>';
					$parent = get_parent_class($parent);
				}
				
				$param_val = array(
					'classname' => '<b>'.get_class($param_val).'</b>'.$parents,
					'objvars' => $objvars, 
					'objfncs' => $objfncs, 
				);
				
				if($print_fullobject ) {
					$param_val['obj'] = $print_fullobject;
				}
			}
//			self::new_echo("<pre>", $param_print, $param_force);
			$string_show .= "<pre>";
			if($param_htmlentities){
				$param_val=self::htmlencode_arrayvalues($param_val);
			}
			self::new_echo($string_show.print_r($param_val, true).'"</pre>"', $param_print, $param_force);
			
			
//echo '#############################'.print_r($param_val, true).'####################';
			//		if(is_object($param_val)) {
			//			self::new_echo("<b>show(Objekt/Klassen Variablen)</b><pre>", $param_print, $param_force);
			//			self::new_echo(print_r(get_class_vars(get_class($param_val)), true), $param_print, $param_force);
			//
			//
			//
			//			self::new_echo("<b>show(Objekt/Klassen Funktionen)</b><pre>", $param_print, $param_force);
			//			self::new_echo(print_r(get_class_methods($param_val), true), $param_print, $param_force);
			//		}

//			self::new_echo("</pre>", $param_print, $param_force);

			//		self::new_echo("______________________<br>", $param_print, $param_force);
		}


	}

	public static function cf($param_string='', $param_print=true, $param_force=false) {
		D::printCurrentFunction($param_print, $param_string, true, $param_force);
	}
	
	/**
	 * Funktion zeigt html liste
	 * <li>$param_string</li>
	 */
	public static function li($param_string, $param_print=true, $param_force=false) {
		D::printCurrentFunction($param_print);
		D::new_echo("<li>".$param_string."</li>", $param_print, $param_force);
	}
	public static function kindof($param_kindof, $param_string="", $param_print=true, $param_force=false) {
		self::printCurrentFunction($param_print);
		self::new_echo("<b>kindof(".$param_string.")</b><pre>", $param_print, $param_force);
		if(is_array($param_kindof)) {
			$var = 'Array count('.count($param_kindof).')';
		} else if(is_object($param_kindof)) {
			$var = 'Object('.get_class($param_kindof).') ';
			if(is_subclass_of($param_kindof, 'MultimediaText')) {
				$var .= ' extends MultimediaText Subject('.$param_kindof->getObjVar('Subject').')';
			} else if(get_class($param_kindof)=='MultimediaText') {
				$var .= ' Subject('.$param_kindof->getObjVar('Subject').')';
			}
		} else if(is_int($param_kindof)) {
			$var = 'Int('.$param_kindof.')';
		} else if(is_bool($param_kindof)) {
			$var = 'Bool('.$param_kindof.')';
		} else if(is_string($param_kindof)) {
			$var = 'String('.$param_kindof.')';
		} else {
			$var = gettype($param_kindof).'';
		}
		$var .= ' = ('.$param_kindof.')';
		if($param_kindof) {
			$var .= ' if('.$param_kindof.' ==> ?true?)';
		} else {
			$var .= ' else if(!'.$param_kindof.') ==> ?false?';
		}
		self::new_echo("<li>".$var."</li>", $param_print, $param_force);
	}
	/**
	 * Funktion zeigt html unter liste
	 * <ul><li>$param_string</li></ul>
	 */
	public static function ulli($param_string, $param_print=true, $param_force=false) {
//		self::printCurrentFunction($param_print);
		self::new_echo("<ul><li>".$param_string."</li></ul>", $param_print, $param_force);
	}
	/**
	 * Funktion zeigt html Überschrift 1 an
	 * <h1>$param_string</h1>
	 */
	public static function h1($param_string, $param_print=true, $param_force=false) {
//		self::new_echo("<br><br>|------------------------------------------------------<br>", $param_print, $param_force);
//		self::backtrace();
		self::new_echo("<h1>".$param_string."</h1>", $param_print, $param_force);
	}
	/**
	 * Funktion zeigt html Überschrift 2 an
	 * <h2>$param_string</h2>
	 */
	public static function h2($param_string, $param_print=true, $param_force=false) {
		self::new_echo("<h2>".$param_string."</h2>", $param_print, $param_force);
	}
	/**
	 * Funktion zeigt html Überschrift 3 an
	 * <h3>$param_string</h3>
	 */
	public static function h3($param_string, $param_print=true, $param_force=false) {
		self::new_echo("<h3>".$param_string."</h3>", $param_print, $param_force);
	}

	/**
	 * Funktion zeigt html Absatz an
	 * <p>$param_string</p>
	 */
	public static function p($param_string, $param_print=true, $param_force=false) {
		self::new_echo("<p>".$param_string."</p>", $param_print, $param_force);
	}

	public static function fe($param_Array, $param_Print=null) {
		$param_Print .= 'count('.count($param_Array).')  || print '.$param_Array;
		D::li($param_Print);
		foreach($param_Array as $var_key => $var_value) {
			D::ulli($var_key.' => '.$var_value);
		}
	}

	/**
	 *	Funktion gibt den Weg zur tatsächliche Funktion zurück
	 *
	 *	@static
	 */

	private static function printCurrentFunction($param_print, $param_string='', $param_onlyFunction=false, $param_force=false) {
		if($param_print) {
			$array = debug_backtrace();
			$i=2;

			if($param_onlyFunction) {
				self::new_echo(''.$array[$i]["class"].$array[$i]["type"].$array[$i]["function"].'(Z'.$array[$i-1]["line"].'): '.$param_string, $param_print, $param_force);
			} else {
				if(is_array($array) && array_key_exists($i,$array)){

					//				echo 'hello<br><pre>';
					//				print_r($array[1]);
					//				echo '</pre>';
					$var_depth = 0;
					for($v=0; $v<count($array);$v++){
						if( array_key_exists('class', $array[$v]) && array_key_exists('class', $array[$i])
						&&
						$array[$v]['class'].$array[$v]['type'].$array[$v]['function']==$array[$i]['class'].$array[$i]['type'].$array[$i]['function']
						){
							$var_depth++;
						}
						//	D::ulli($v.': '.$array[$v]['class'].$array[$v]['type'].$array[$v]['function']);
					}
//echo $param_string;
					self::new_echo($param_string."    <i style=\"font-size:12;color:gray;\"><b>".$array[$i]["class"].$array[$i]["type"].$array[$i]["function"]."()</b> <span title='Rekursionstiefe'>(RT:$var_depth)</span> call in row ".$array[$i]["line"]." in <a href=\"".substr($array[$i]["file"],strpos($array[$i]["file"],"httpdocs")+8)."\">".basename($array[$i]["file"])."</a></i> => [<i style=\"font-size:10;color:gray;\">".$array[$i-1]['class'].$array[$i-1]['type'].$array[$i-1]['function']."() call in ".basename($array[$i-1]["file"])." Zeile: ".$array[$i-1]["line"]." </i>]", $param_print);
					//echo '___________<pre>';
					//echo	print_r($array[$i], true);
					//echo '</pre>';
				}				
			}
		}
	}

	/**
	 * 
	 * @param object|classname $param_class
	 * @param string $param_fncname
	 * @param bool $param_onlyReturn
	 * @return array
	 */
	public static function printClassesforFunction($param_class, $param_fncname, $param_onlyReturn, $param_print=true, $param_force=false, $param_htmlentities=false) {
		if(is_object($param_class)) {
			$classname = get_class($param_class);
			
		} else if(class_exists($param_class)) {
			$classname = $param_class;
		}
		$result = array();
		
		do {
			$methods = get_class_methods($classname);
//			D::show($methods, $classname);
			if(array_search($param_fncname, $methods)) {
				$result[] = array($classname => $param_fncname);
			}
		} while ($classname = get_parent_class($classname));
		
		if(empty($result)) {
			return D::printClassesforFunction($param_class, '__call', $param_onlyReturn);
		}
		
		if($param_onlyReturn) {
			return $result;
		} else {
//			D::show($result, $param_fncname);
			
			self::printCurrentFunction($param_print,"<br>______________________<br>");
			$string_show = "<br /><b>printClassesforFunction(".$param_fncname.")</b><br />";
			$string_show .= "<pre>";
			if($param_htmlentities){
				$param_val=self::htmlencode_arrayvalues($result);
			}
			self::new_echo($string_show.print_r($result, true).'"</pre>"', $param_print, $param_force);
	
			
			return $result;
		}
	}
	
	
	public static function  backtrace($class=null, $param_print=true, $param_force=false) {
		self::printCurrentFunction($param_print);
		//echo '<h1>backtrace('.$class.')</h1>';
		self::new_echo('<h1>backtrace('.$class.')</h1>', $param_print, $param_force);
		$array = debug_backtrace();
		$k=0;
		
		$table_start = '<table border="1">' ;
		$table_start .= '<tr valign="top"><td align="right">Klasse</td><td>Funktion</td><td>Datei</td></tr>';
		self::new_echo($table_start, $param_print, $param_force);
		
		for($i=count($array)-1; $i!=0; $i--) {
			$k++;

			$var_string = '<tr valign="top">';
			$var_string .= '<td align="right">';

			if(array_key_exists('class', $array[$i]) && array_key_exists('type', $array[$i])) {
				$var_string .=	"".$array[$i]["class"].$array[$i]["type"].'';
			}
			$var_string .= '</td>';
			$var_string .= '<td>';

			$var_string .= $array[$i]["function"]."(...) ";

			$var_string .=	" ... fnc call in row ".$array[$i]["line"]." " .
//							"in der Datei <a title=\"".$array[$i]["file"]."\" href=\"".substr($array[$i]["file"],strpos($array[$i]["file"],"httpdocs")+8)."\">".basename($array[$i]["file"])."</a>" .
//					"in der Datei <a title=\"".$array[$i]["file"]."\" href=\"".substr($array[$i]["file"],strpos($array[$i]["file"],"httpdocs")+8)."\">".basename($array[$i]["file"])."</a>" .
//					"in der Datei <a title=\"".$array[$i]["file"]."\" href=\"".$array[$i]["file"]."\">".basename($array[$i]["file"])."</a>" .					
					"";			

			//			echo($var_string);
			$var_string .= '</td>';
			$var_string .= '<td><span style=\"font-size:6;\">'.  dirname($array[$i]["file"]).'/<b>'.basename($array[$i]["file"]).'</b></span></td>';
			$var_string .= '</tr>';
			self::new_echo($var_string, $param_print, $param_force);
		}
		$table_stop = '</table>' ;
		self::new_echo($table_stop, $param_print, $param_force);		
	}

	/**
	 *
	 * @param bool $param_htmltags default false
	 * @param int $param_start default 1
	 * @param int $param_end default 0
	 * @return string
	 */
	public static function getBacktrace($param_htmltags=false, $param_start=1, $param_end=0) {

		if($param_htmltags) {
			$htmltag_li_strong_b = '<li><strong style=\"font-size:8;color:gray;\"><b>';
			$htmltag_b = '</b>';
			$htmltag_strong_li = '</strong></li>';
		} else {
			$htmltag_li_strong_b = '';
			$htmltag_b = '';
			$htmltag_strong_li = '';
		}

		$return_string = '';
		$array = debug_backtrace();
		$k=0;

		$start = count($array)-$param_start;

		if($start <= $param_end) {
			$param_end = $start-1;
		}

		for($i=$start; $i!=$param_end; $i--) {
			$k++;
			$ul_start="";
			$ul_end="";
			if($param_htmltags) {
				for($j=0; $j<$k; $j++) {
					$ul_start .= "<ul>";
					$ul_end .= "</ul>";
				}
				$htmltag_start_a = "<a href=\"".substr($array[$i]["file"],strpos($array[$i]["file"],"httpdocs")+8)."\">";
				$htmltag_end_a = '</a>';
				$tag_endline = '';
			} else {
				$ul_start="* ";
				$htmltag_start_a = '';
				$htmltag_end_a = '';
				$tag_endline = "\n
					".'
						';
			}


			$var_string = $ul_start."" .$htmltag_li_strong_b;

			if(array_key_exists('class', $array[$i]) && array_key_exists('type', $array[$i])) {
				$var_string .=	"".$array[$i]["class"].$array[$i]["type"];
			}


			$var_string .= $array[$i]["function"]."(...) ";

			$var_string .=	$htmltag_b." fnc call in row ".$array[$i]["line"]." " .
							"in file ".$htmltag_start_a.basename($array[$i]["file"]).$htmltag_end_a .
					$htmltag_strong_li.$ul_end.$tag_endline;

			$return_string .= $var_string;
		}
		return $return_string;
	}

	private static $StartTime;

	public static function start() {
		self::$StartTime = time();
	}
	public static function stop($param_startTime=null, $param_string=null, $param_print=true, $param_force=false) {
		if($param_startTime==null) {
			$param_startTime = self::$StartTime;
		}
		$zeit = getdate(time() - $param_startTime);

		self::new_echo("<li><b>".$param_string."</b> ==>> <b>".$zeit["minutes"]."</b> min <b>".$zeit["seconds"]."</b> sec</li>", $param_print, $param_force);
	}


	private static function showdomelement($param_XMLElement, $param_string=null,$param_print=true, $param_force=false) {


		$count_elements=0;
		foreach($param_XMLElement->childNodes as $element) {
			if($element->nodeType == 1) {
				$string .= 'nodeName: '. $element->nodeName ." | Content: ". $element->textContent  . "<br>"  ;
				$test= $element->nodeName ;
				$count_elements++;
			}
		}
		$var_label = $param_XMLElement->getAttribute('label');
		if($var_label) {
			$string_init = '<br/><b>'.$param_XMLElement->tagName.'</b>  label('.$var_label.') ';
		}
		$string_init .=  'Number of Elements: ' .$count_elements.'<br>';
		self::new_echo("$string_init <pre>", $param_print, $param_force);
		self::new_echo($string.'</pre>',$param_print, $param_force);





	}

	public static function showdomdoc($param_XMLElement, $param_string=null,$param_print=true, $param_force=false) {
		$count_elements=0;
		foreach($param_XMLElement->childNodes as $element) {
			if($element->nodeType == 1) {
				$string .= 'nodeName: '. $element->nodeName ." | Content: ". $element->textContent  . "<br>"  ;
				$test= $element->nodeName ;
				$count_elements++;
			}
		}


		$string .=  'Number of Elements: ' .$count_elements.'<br>';
		self::new_echo("<b>showdomdoc(".$param_string.")</b><pre>", $param_print, $param_force);
		self::new_echo('</pre>'.$string,$param_print, $param_force);
	}

	public static function showdomxpath($param_DOMDOC, $param_query,$param_string=null,$param_print=true, $param_force=false) {
		$xp = new domxpath($param_DOMDOC);
		$titles = $xp->query("/". $param_query ."");
		$count_elements=0;
		$string = get_class($param_DOMDOC).': => ';
		foreach ($titles as $node) {
			$string .= '<b> NodeName: </b> <br>'.$node->nodeName .'</b><br><b> NodeContent: </b><br>'.$node->textContent . " <br>";
			//    		$string .= "<br>{$node->previousSibling->previousSibling->previousSibling->previousSibling->previousSibling->previousSibling->previousSibling->previousSibling->nodeValue},<br>";

			$count_elements++;
		}
		$string .=  'Number of Elements: ' .$count_elements.'<br>';
		self::new_echo("<b>showdomxpath(".$param_string.")</b><b>query(".'/'.$param_query.")</b><pre>", $param_print, $param_force);
		self::new_echo('</pre>'.$string,$param_print, $param_force);
	}

	/**
	 *	@todo irgendwie muss das anders ....
	 *		alles was mcClasses ist in @see D::showStats und den Rest ganz raus
	 *
	 * @global <type> $time_index
	 * @global <type> $var_ErrorWarnString
	 * @global <type> $_TREE
	 */
	public static function showGeneralSoftwareAbstractInfos() {
		global $time_index;
		global $var_ErrorWarnString;
		global $_TREE;
		echo '__ <p><br /></p><div class=\'AbstractInfos\'>';
		D::stop($time_index, $var_ErrorWarnString.' ###  index ('.$_TREE.') komplett mit Temp Ausgabe');
		D::p('' .
				'TreeManipulator: runTree('.TreeManipulator::$count_runTree.') cb_getBasisClipboard('.TreeManipulator::$count_runTreeCallback_getBasisClipboard.') || runDBTree('.TreeManipulator::$count_runDBTree.')   cb_catchInfoboxData('.CatchInfoboxDataTMC::$count_callbackFunction.')<br>' .
				'MultimediaText(<b>'.MultimediaText::$counter_____construct.' / '.count(MultimediaText::$MTextArray).'[!!!'.MultimediaText::$DoppeltGeladen.'!!!]</b>) loadObject('.MySql::$count_loadObject.') getObjDOMElement(<b>'.BasisElement::$getObjDOMElement_counter.'</b>['.BasisElement::$getObjDOMElement_counter_diff.']) runTree('.Controller::$count_runTree.')<br>' .
				'Mysql(<b>'.BasicMySql::$count___construct.'</b>):  query(<b>'.BasicMySql::$MySql_count_query.'</b>/ SR<b>'.BasicMySql::$PDOSRequest_count_query.'</b>) nextRow(<b>'.BasicMySql::$count_nextRow.'</b>) checkAuthorisationQuery(<b>'.Mysql::$count_checkAuthorisationQuery.'</b>)<br> ' .
				'getMultimediaTextData('.MySql::$count_getMultimediaTextData.') => getClassNameFromMTextID('.MySql::$count_getClassNameFromMTextID.') => getPrefsBE_SQL_Data('.CONFIG::$count_getSQL_Data.')  ==>> Infobox('.Infobox::$count_Infobox.')'.
				'CONFIG transformStringToArray('.CONFIG::$count_transformStringToArray.') '.
			'');

		D::li('geladene MultimediaTexte (index.php)');
		$index=1;
		foreach(MultimediaText::$MTextArray as $key => $value) {
			$index++;

			if(!is_array($value->getObjVar('LoadLevel')) || $var_key_LoadLevel = array_keys($value->getObjVar('LoadLevel'))) {
				$var_key_LoadLevel = array();
			}
			if(!is_array($var_key_LoadLevel)) {
				$var_key_LoadLevel = array();
			}
			D::ulli($index.' $key('.$key.') ID('.$value->getObjVar('ID').')  Subject('.$value->getObjVar('Subject').') LoadLevel('.Form::arrayToVarchar($var_key_LoadLevel).')');
		}
		echo '</div>';
	}

	public static function showStats(array $__mc_Report, $__BASEPATH_EX, $__mc_D_LOGFILE) {
		$var_ErrorWarnString = date('d. m. Y  G:i:s').': ';

		if(array_key_exists('REMOTE_HOST', $_SERVER))  {
			$HOST = $_SERVER['REMOTE_HOST'];
		} else {
			$HOST = '';
		}
		
		
		$a_start = '<a href="'.$HOST.'/'.$__mc_D_LOGFILE.'" >';
		$a_end = '</a>';
		$var_ErrorWarnString .= ' '.$a_start.'D('.count(self::$echo_lines).')'.$a_end.' ';


		if(mcNoticeEvent::$count) {
			if(array_key_exists('mcNoticeEvent', $__mc_Report) && is_array($__mc_Report['mcNoticeEvent']) && array_key_exists('toFile', $__mc_Report['mcNoticeEvent']) && is_array($__mc_Report['mcNoticeEvent']['toFile'])) {
				$a_start = '<a href="'.$HOST.'/'.$__mc_Report['mcNoticeEvent']['toFile']['file'].'" style=\"font-size:15;color:orange;\">';
				$a_end = '</a>';
			} else {
				$a_start = $a_end = '';
			}
			$var_ErrorWarnString .=  ' '.$a_start.'mcNoticeEvent('.mcNoticeEvent::$count.')'.$a_end.' ';
		} else {
			$var_ErrorWarnString .= ' '.'mcNoticeEvent(0) ';
		}

		if(Error::$Quantity) {
			if(array_key_exists('Error', $__mc_Report) && is_array($__mc_Report['Error']) && array_key_exists('toFile', $__mc_Report['Error']) && is_array($__mc_Report['Error']['toFile'])) {
				$a_start = '<a href="'.$HOST.'/'.$__mc_Report['Error']['toFile']['file'].'" style=\"font-size:15;color:red;\">';
				$a_end = '</a>';
			} else {
				$a_start = $a_end = '';
			}
			$var_ErrorWarnString .=  ' '.$a_start. 'Error('.Error::$Quantity.')'.$a_end.' ';
		} else {
			$var_ErrorWarnString .= ' '.'Error(0) ';
		}

		if(mcException::$count) {
			if(array_key_exists('mcException', $__mc_Report) && is_array($__mc_Report['mcException']) && array_key_exists('toFile', $__mc_Report['mcException']) && is_array($__mc_Report['mcException']['toFile'])) {
				$a_start = '<a href="'.$HOST.'/'.$__mc_Report['mcException']['toFile']['file'].'" style=\"font-size:15;color:red;\">';
				$a_end = '</a>';
			} else {
				$a_start = $a_end = '';
			}
			$var_ErrorWarnString .=  ' '.$a_start.'mcException('.mcException::$count.')'.$a_end.' ';
		} else {
			$var_ErrorWarnString .= ' '.'mcException(0) ';
		}


		if(mcErrorEvent::$count) {
			if(array_key_exists('mcErrorEvent', $__mc_Report) && is_array($__mc_Report['mcErrorEvent']) && array_key_exists('toFile', $__mc_Report['mcErrorEvent']) && is_array($__mc_Report['mcErrorEvent']['toFile'])) {
				$a_start = '<a href="'.$HOST.'/'.$__mc_Report['mcErrorEvent']['toFile']['file'].'" style=\"font-size:15;color:red;\">';
				$a_end = '</a>';
			} else {
				$a_start = $a_end = '';
			}
			$var_ErrorWarnString .= $a_start.'ErrorEvent('.mcErrorEvent::$count.')'.$a_end.' ';
		} else {
			$var_ErrorWarnString .= 'ErrorEvent(0) ';
		}

		D::stop(null, $var_ErrorWarnString);
	}


}

?>