Location: PHPKode > projects > OpenWolf Guidelines Validator > openWolf 0.9.9/nz/parse.class.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/

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


define('PRIORITY_STANDARD', 'Standard');
define('PRIORITY_RECOMMENDATION', 'Recommendation');

define('RESULT_PASS', 0);
define('RESULT_USER', 1);
define('RESULT_NOT_CHECKED', 2);
define('RESULT_WARNING', 3);
define('RESULT_FAIL', 4);

define('USER_CHECK', 'The site administrator needs to confirm this.');
define('NOT_CHECKED', 'This requirement cannot be automatically checked.');

define('INSTANCE_LIMIT', 3);
define('MAX_CHILDREN_SHOWN', 3);

define('RESULT_PASS_CLASS', 'rl_pass');
define('RESULT_USER_CLASS', 'rl_user');
define('RESULT_NOT_CHECKED_CLASS', 'rl_check');
define('RESULT_WARNING_CLASS', 'rl_warning');
define('RESULT_FAIL_CLASS', 'rl_fail');

class parse extends Parse_core {

	//NZ WSR-specific values:
	var $_department_name;
	var $_check_links;
	var $_homepage;
	
	function parse($url){
		//validate the webpage address:
		//NOTE: what to do with sites like http://example.com/test ?
		//This will remove queries (optional), and attach the default page if it is not already present
		
		$baseUrl=get_base_url($url, true);
		if(substr($baseUrl,-1)!='/'){
			$baseUrl.='/';
		}
	
		$this->setBaseUrl($baseUrl);
		$this->setCurrentPage($url);
		$this->setDomain(get_domain($url));
		//END OF webpage address validation
	}
	
	//NZ WSR-specific values:
	function departmentName($value=''){
		if($value=='')
			return $this->_department_name;
		else
			$this->_department_name=$value;
		
	}
	
	function check_links($value=''){
		if($value=='')
			return @$this->_check_links;
		else 	@$this->_check_links=$value;
	}

	function homepage(){
		
		if($this->_homepage==''){
			$bits=parse_url($this->currentPage);
		
			if(!isset($bits['host']))
				$this->_homepage='';
				
			$part1=$bits['scheme'] . '://' . $bits['host'];
			$part2='';
			if(@$bits['port']!='')
				$part2= ':' . $bits['port'];
				
			$this->_homepage=$part1 . $part2;
		}
		
		return $this->_homepage;
		
	}
}

?>
Return current item: OpenWolf Guidelines Validator