<?
 
/**
 
 * Html - Helper class to generate a few HTML entities
 
 * Author - Brett Dutton
 
 */
 
class Html {
 
    /** Adds the HTML Script tags to the provided javascript string and returns
 
     ** the resulting HTML
 
     ** @param $str The javascript string
 
     **/
 
    function javaScript ( $str ) {
 
        return ( "<script type=\"text/javascript\" language=\"JavaScript\">\n$str\n</script>\n" );
 
    }
 
 
    /** Creates and returns the HTML required to display an image
 
     ** @param $s The src of the image
 
     ** @param $xtra Any extra attributes
 
     **/
 
    function img ( $s, $xtra=NULL ) {
 
        $a = "<img src=\"$s\"";
 
        if ( $xtra != NULL && $xtra != "" ) $a .= " " . $xtra;
 
        $a .= ">";
 
        return ( $a );
 
    }
 
 
    /**
 
     ** function to create the text for href output
 
     ** @param $ref URL
 
     ** @param $str The image or text for this link
 
     ** @param $extra any extra parameters
 
     **/
 
    function hRef ( $ref=NULL, $str=NULL, $extra=NULL ) {
 
        if ( $ref == NULL || $str == NULL ) return ( " " );
 
        else {
 
            $a = "<a href=\"$ref\"";
 
            if ( $extra != NULL && $extra != "" ) $a .= " $extra";
 
            $a .= ">$str</a>";
 
            return ( $a );
 
        }
 
    }
 
}
 
?>
 
 |