All pastes #90460 Raw Edit

Ashe

public php v1 · immutable
#90460 ·published 2006-07-17 18:13 UTC
rendered paste body
/*** Straight-forward strategy: escape any token that is not inline HTML** Known issue: templates need to be rechecked everytime the value of the php.ini* settings asp_tags or short_tags is changed*/$tokens = token_get_all('<?php ?>' . $this->uncompiled_code);$this->uncompiled_code = '';foreach ($tokens as $i => $token){	if (!is_array($token))	{		$this->uncompiled_code .= $token;	}	elseif ($token[0] == T_OPEN_TAG || $token[0] == T_CLOSE_TAG)	{		if ($i > 1)		{			$this->uncompiled_code .= htmlspecialchars($token[1]);		}	}	else	{		$this->uncompiled_code .= $token[1];	}}unset($tokens);/*** More tokenizer oddities*/if (!strncmp($this->uncompiled_code, '<?php ?&gt;', 11)){	$this->uncompiled_code = substr($this->uncompiled_code, 11);}