Location: PHPKode > projects > Zitro-Stats > include/out.inc.php
<?php

	// ANTIHACK
	defined('INSTATS') OR die();

	define('OUT',true);

	function out_indent($html,$tabs=1) {
		return $tabs ?
			str_repeat("\t",$tabs).
			str_replace("\n","\n".str_repeat("\t",$tabs),substr($html,0,-1)).
			"\n":
			$html;
	}

	function out_table($html,$attrib='') {
		return
			"<table".
			($attrib ? " $attrib" : " class=\"tab\"").
			" cellspacing=\"0\"".
			" cellpadding=\"0\"".
			" border=\"0\">\n".
			out_indent($html).
			"</table>\n";
	}

	function out_table_caption($html) {
		return
			"<caption>".
			$html.
			"</caption>".
			"\n";
	}

	function out_table_head($html='') {
		return
			"<thead>\n".
			out_indent($html).
			"</thead>\n";
	}

	function out_table_body($html='') {
		return
			"<tbody>\n".
			out_indent($html).
			"</tbody>\n";
	}

	function out_table_foot($html='') {
		return
			"<tfoot>\n".
			out_indent($html).
			"</tfoot>\n";
	}

	function out_table_row($html='',$class='') {
		return
			"<tr".
			($class ? " class=\"$class\"" : "").
			">\n".
			out_indent($html).
			"</tr>\n";
	}

	define('H',	"class=\"head\"");
	define('L',	"align=\"left\"");
	define('R',	"align=\"right\"");
	define('C',	"align=\"center\"");
	function out_table_cell($highlight=FALSE,$cols=1,$rows=1,$html='',$attrib='') {
		return
			"<t".($highlight ? "h" : "d").
			($attrib ? " $attrib" : "").
			($cols>1 ? " colspan=\"$cols\"" : "").
			($rows>1 ? " rowspan=\"$rows\"" : "").
			">".
			$html.
			"</t".($highlight ? "h" : "d").">".
			"\n";
	}

	function out_table_cells_player($highlight=FALSE,$rows=1,$player='') {
		global $options;
		return
			out_table_cell($highlight,1,$rows,"<a href=\"?inc=player&amp;name=".urlencode($player)."\"><img src=\"images/player.gif\" alt=\"Player: ".htmlentities($player)."\" /></a>",R).
			out_table_cell($highlight,1,$rows,"<a href=\"?inc=player&amp;name=".urlencode($player)."\">".str_replace(" ","&nbsp;",htmlentities($player))."</a>",L);
	}

	function out_clanname($name) {
		return preg_replace('(&amp;#(\d{1,6}|x[\da-f]{1,5});)i','&#$1;',htmlentities($name));
	}
	function out_table_cells_clan($highlight=FALSE,$rows=1,$clan='',$name='') {
		global $options;
		return $clan ?
			out_table_cell($highlight,1,$rows,"<a href=\"?inc=clan&amp;name=".urlencode($clan)."\"><img src=\"images/clan.gif\" alt=\"Clan: ".htmlentities($clan)."\" /></a>",R).
			out_table_cell($highlight,1,$rows,"<a href=\"?inc=clan&amp;name=".urlencode($clan)."\">".htmlentities($clan)."</a>".($name ? "<br /><span class=\"smaller\">".out_clanname($name)."</span>" : ""),L):
			out_table_cell($highlight,2,$rows);
	}

	function out_table_cells_weapon($highlight=FALSE,$rows=1,$weapon='') {
		global $options;
		return
			out_table_cell($highlight,1,$rows,"<a href=\"?inc=weapon&amp;name=".urlencode($weapon)."\"><img src=\"images/weapons/$weapon.gif\" alt=\"Weapon: ".htmlentities($weapon)."\" /></a>",R).
			out_table_cell($highlight,1,$rows,"<a href=\"?inc=weapon&amp;name=".urlencode($weapon)."\">".htmlentities($weapon)."</a>",L);
	}

	function out_table_cells_bar($highlight=FALSE,$rows=1,$count,$min,$max,$barclass='bar',$size=32,$height=6) {
		return
			out_table_cell($highlight,1,$rows,$count,R).
			out_table_cell($highlight,1,$rows,
				"<table class=\"bar\" cellspacing=\"0\" cellpadding=\"0\" border=\"0\">".
				"<tr>".
				($count>$min?
					($count<$max?
						"<td class=\"$barclass\"><div style=\"width:".($w=max(1,min($size-1,round($size*($count-$min)/($max-$min)))))."px; height:".$height."px;\"><br /></div></td>".
						"<td><div style=\"width:".($size-$w)."px; height:".$height."px;\"><br /></div></td>"
						:
						"<td class=\"$barclass\"><div style=\"width:".$size."px; height:".$height."px;\"><br /></div></td>"):
					"<td><div style=\"width:".$size."px; height:".$height."px;\"><br /></div></td>").
				"</tr>".
				"</table>",
				L);
	}

	function out_history($filter=array(),$text='') {
		global $options;
		return
			"<a href=\"?inc=history".
			(@$filter['type']?"&amp;type=".$filter['type']:"").
			(@$filter['player']?"&amp;player=".urlencode($filter['player']):"").
			(@$filter['opponent']?"&amp;opponent=".urlencode($filter['opponent']):"").
			(@$filter['weapon']?"&amp;weapon=".urlencode($filter['weapon']):"").
			"\"><img src=\"images/history.gif\" alt=\"History\" />".
			($text?" ".$text:"").
			"</a>";
	}

	function out_time($start,$stop,$reverse=0) {
		preg_match("/((?:(?:\d+)?\.)?\d+)[ \n]?((?:(?:\d+)?\.)?\d+)/",$start,$start);
		preg_match("/((?:(?:\d+)?\.)?\d+)[ \n]?((?:(?:\d+)?\.)?\d+)/",$stop ,$stop);
		return ($stop[2-$reverse]-$start[2-$reverse])+($stop[1+$reverse]-$start[1+$reverse]);
	}

?>
Return current item: Zitro-Stats