コード例 #1
0
	/**
	 * Construct the XML
	 *
	 * @access public
	 * @since 1.0
	 */
	public function constructXML()
	{
		$this->_xmlToolBox->startTag("Session");
		
		$params = $this->_session->getParams();		
		uksort($params,"strnatcasecmp");
		$this->_xmlToolBox->startTag("params");
		foreach($params as $key => $value)
		{
			$type = "string";

			if (empty($value))
				$value = "null";
			if (is_object($value))
			{
				$value = str_replace("\t","    ", SLS_String::printObject(json_encode($value)));
				$type = "object";
			}
			else if (is_array($value))
			{
				$value = str_replace("\t","    ", SLS_String::printArray($value));
				$type = "array";
			}
			$this->_xmlToolBox->startTag("param", array("type" => $type));
			$this->_xmlToolBox->addFullTag("name",$key,true);
			$this->_xmlToolBox->addFullTag("value",$value,true);
			$this->_xmlToolBox->endTag("param");
		}
		$this->_xmlToolBox->endTag("params");
		
		$this->_xmlToolBox->endTag("Session");
	}	
コード例 #2
0
	/**
	 * Get trace infos	 
	 *
	 * @access public static
	 * @param array $traceElt associative array contained trace informations recovered by the raise of the exception
	 * @param bool $html if we want a HTML render (version dev)
	 * @return string $trace trace infos shaped (html ou plain)
	 * @since 1.0
	 */
	public static function getTraceInfo($traceElt,$html=false) 
	{
		$info = $traceElt['class'] . $traceElt['type'] . $traceElt['function'];
		$info .= '(';
		if ($traceElt['args']) 
		{			
			for ($i = 0; $i < count($traceElt['args']); $i++) 
			{
				$arg = $traceElt['args'][$i];				
				if ($html)
				{
					if (is_array($arg))
						$info .= '<a href="#" onclick="return false;" class="tooltip" title="'.gettype($arg).'" rel="<pre name=\'highlight_'.uniqid().'\' class=\'brush:php\'>'.SLS_String::printArray($arg).'</pre>">'.gettype($arg).'</a>';
					else if (is_object($arg))
						$info .= '<a href="#" onclick="return false;" class="tooltip" title="'.get_class($arg).'" rel="<pre name=\'highlight_'.uniqid().'\' class=\'brush:js\'>'.SLS_String::printObject(str_replace(array('"',':'),array("'",': '),json_encode($arg))).'</pre>">'.gettype($arg).'</a>';
					else 
					{
						if (is_string($arg) && (SLS_String::startsWith(trim(strtolower($arg)),"select") || SLS_String::startsWith(trim(strtolower($arg)),"update") || SLS_String::startsWith(trim(strtolower($arg)),"insert") || SLS_String::startsWith(trim(strtolower(arg)),"delete")))
							$info .= '<a href="#" onclick="return false;" class="tooltip" title="'.gettype($arg).'" rel="<pre name=\'highlight_'.uniqid().'\' class=\'brush:sql\'>'.(is_string($arg) ? trim($arg) : $arg).'</pre>">'.gettype($arg).'</a>';
						else	
							$info .= '<a href="#" onclick="return false;" class="tooltip" title="'.gettype($arg).'" rel="<pre name=\'highlight_'.uniqid().'\' class=\'brush:php\'>&#34;'.(is_string($arg) ? trim($arg) : $arg).'&#34;</pre>">'.gettype($arg).'</a>';
					}					
				}
				else
					$info .= is_object($arg) ? get_class($arg) : ''.gettype($arg).'';
				if ($i < count($traceElt['args']) - 1)
					$info .= ', ';				
			}
		}
		$info .= ')';
		return $info;
	}