Location: PHPKode > scripts > rhc class > rhc-class/rhc_baseclass.php
<?php
/*
BASECLASS: a php class which handles debugging for all classes and extensions to follow
AUTHOR: Rick Hopkins
DATE: October 3, 2002
UPDATED LAST: October 16, 2002
*/

/********************************************************************************************************************************/
class baseclass
{//class in-session
	//declare variables
	var $debug_flag;
	
	/********************************************************************/
	//function baseclass() is run when (bc=new baseclass()) is initialized: checks the GLOBAL["DEBUG"] variable
	function baseclass()
	{
		//set $DEBUG to 1 to display debugging text, set to zero when script goes public
		if ($GLOBALS["DEBUG"] > 0){
			$this->set_debug_on();
			}
		
		//set $BETA_PHASE to 1 to not include the error_handling script, set to zero when script goes public
		if ($GLOBALS["BETA"] < 1){
			include("rhc_error_handling.php");
			}
	}
	
	/********************************************************************/
	//function set_debug_on() sets the $debug_flag to 1 so that Debug Text is displayed
	function set_debug_on()
	{
		$this->debug_flag = 1;
	}
	
	/********************************************************************/
	//function set_debug_off() sets the $debug_flag to 0 so Debug Text is not displayed
	function set_debug_off()
	{
		$this->debug_flag = 0;
	}
	
	/********************************************************************/
	//function debug_status() returns the status of the $debug_flag
	function debug_status()
	{
		return $this->debug_flag;
	}
	
	/********************************************************************/
	//function write_debug_log() print out all debug text that is passed to it by other functions as long as $debug_flag > 0
	function write_debug_log($debug_text, $color)
	{
		//Green Means Go, Red Means Stop
		if ($this->debug_flag){
			printf("<font style=\"font-family:Verdana, Arial; font-weight:bold; color:$color; font-size:10px;\">DEBUG MESSAGE: %s<br></font>", $debug_text);
			}
	}
	
	/********************************************************************/
}//class out
/********************************************************************************************************************************/
?>
Return current item: rhc class