Location: PHPKode > projects > OpenWolf Guidelines Validator > openWolf 0.9.9/ajax.php
<?php

/*************************************************

openWolf - an HTML accessibility guidelines validator
Author: Geoff Munn (hide@address.com)
Version: 0.9.9

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.

You may contact the author of openWolf by e-mail at: hide@address.com

The latest version of openWolf can be obtained from:
http://openwolf.sourceforge.net/

*************************************************/

if($_REQUEST['show_errors']=='t'){
	ini_set('display_errors', true);
	error_reporting(E_ALL);
} else {
	ini_set('display_errors', false);
	error_reporting(0);
}

set_time_limit(300);
ini_set('memory_limit','80M');

session_start();

header("Content-type: text/xml");
$xml="<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";

//For this, we are going to get all the necessary information from the $_SESSION variable
//Make sure that messages, count are always available.

$messages=@$_SESSION['messages'];
if($messages=='')
	$messages=Array();

$count=@$_SESSION['count'];
if($count=='')
	$count=0;
	
$percent=round(($count/74)*100);
$xml.="<messages count=\"" . $count . "\" percent=\"";
$xml.=$percent;
$xml.="\">\n";
foreach($messages as $this_message){
	$xml.="\t<message is_rule=\"";
	if($this_message['is_rule']==true)
		$xml.="true";
	else $xml.="false";
	
	$xml.="\" type=\"" . $this_message['type'] . "\"";
	$xml.=" class=\"" . $this_message['class'] . "\"";
	$xml.=" id=\"" . $this_message['id'] . "\"";
	
	$xml.=">\n";
	$xml.="\t\t<rule>" . $this_message['rule'] . "</rule>\n";
	$xml.="\t\t<text>" . htmlspecialchars($this_message['text']) . "</text>\n";
	$xml.="\t</message>\n";	
}
$xml.="</messages>";

//delete the messages we have in memory
$_SESSION['messages']=Array();
print $xml;

?>
Return current item: OpenWolf Guidelines Validator