Login   Register  
PHP Classes
elePHPant
Icontem

File: classinfo.b1.class.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Ariel Filipiak  >  Classinfo class  >  classinfo.b1.class.php  >  Download  
File: classinfo.b1.class.php
Role: ???
Content type: text/plain
Description: Class
Class: Classinfo class
Like phpinfo() but for ALL your classes!!!
Author: By
Last change:
Date: 12 years ago
Size: 4,159 bytes
 

Contents

Class file image Download
<?php

#################################################################################
# Class: classinfo v.b1                                         Date: May-07-2002
# Author: Ariel Filipiak <hapu@nopasar.com>
#            This code is released under GPL (GNU Public License)                
# Feel free to edit/use so long as you keep this copyright. USE at your own risk! 

class classinfo {

    var $version;
    var $location;
    var $modified;
    var $constructor;
    var $vars;

    function classinfo($s_version, $s_location, $s_constructor) {
        $this->version      = $s_version;
        $this->location     = $s_location;
        $this->modified     = date("D jS M Y", filemtime($s_location));
        $this->constructor  = $s_constructor;
    }

    function info($s_noshow = "") {

        if ($s_noshow) {
            $s_infoini = "\n<!--\n\n"; 
            $s_rowsep.= " = ";
            $s_headend = "\n-------------------------------------------------------\n";
            $s_caption = "\nVariables:\n\n";
            $s_rowend = "\n";
            $s_infoend.= "Generated by classinfo v.b1\n";
            $s_infoend.= "Location: ".__FILE__."\n-->\n";    
        } else {
            if(ereg("^3\.", phpversion())) {
                $s_tableini = "<table border=5 cellpadding=2>";
                $s_thcolor  = " bgcolor='#00DDDD'";
                $s_trcolor  = " bgcolor='#DDDDDD'";
                $s_tdcolor  = " bgcolor='#999999'";
            } else {
                $s_tableini = "<table border=0 cellpadding=2 cellspacing=1 bgcolor='#000000'>";
                $s_thcolor  = " bgcolor='#9999cc'";
                $s_trcolor  = " bgcolor='#cccccc'";
                $s_tdcolor  = " bgcolor='#ccccff'";
            }
            $s_infoini = "<STYLE TYPE='text/css'><!--\n";
            $s_infoini.= "td.classinfo    { font-family: arial,helvetica,sans-serif; font-size: 10pt;}\n";
            $s_infoini.= "pre.classinfo   { font-family: arial,helvetica,sans-serif; font-size: 10pt; margin:0;}\n";
            $s_infoini.= "big.classinfo   { font-family: arial,helvetica,sans-serif; font-size: 12pt; margin: 0;}\n";
            $s_infoini.= "small.classinfo { font-family: arial,helvetica,sans-serif; font-size:  8pt;}\n";
            $s_infoini.= "//--></STYLE>\n<center><br>$s_tableini\n";
            $s_headini = "<tr valign='middle'$s_thcolor><td colspan='2' align='left'><big class='classinfo'><b>";
            $s_headend = "</b></big></td></tr>\n";
            $s_caption = "<tr valign='top'$s_thcolor><td class='classinfo' align=center><b>Variable</b></td>";
            $s_caption.= "<td class='classinfo' align=center><b>Value</b></td></tr>\n";
            $s_rowini  = "<tr valign='top'$s_trcolor><td$s_tdcolor class='classinfo'%s><b>";
            $s_rowsep  = "</b></td><td class='classinfo'>";
            $s_rowend  = "</td></tr>\n";
            $s_preini  = "<pre class='classinfo'>";
            $s_preend  = "</pre>";
            $s_infoend = "<tr$s_thcolor><td colspan=2 align=center><small class=classinfo>";
            $s_infoend.= "Generated&nbsp;by&nbsp;<b>classinfo&nbsp;v.b1</b>\n";
            $s_infoend.= "(Location:&nbsp;".__FILE__.")</small></td></tr></table></center><br>\n";
        }
        echo $s_infoini.$s_headini."Class".($this->version ? ": ".$this->version : "").$s_headend;
        echo ($this->location ? $s_rowini."Location".$s_rowsep.$this->location.$s_rowend : "");
        echo ($this->location ? $s_rowini."Modified".$s_rowsep.$this->modified.$s_rowend : "");
        echo ($this->constructor ? $s_rowini."Constructor".$s_rowsep."new ".$this->constructor.";".$s_rowend : "");
        if (count($this->vars) == 0): echo $s_infoend; return; endif;
        echo $s_caption;
        $print_r = (function_exists('print_r') ? "print_r" : "var_dump");
        while (list($s_var, $m_val) = each($this->vars)) {
            echo $s_rowini.$s_var.$s_rowsep.$s_preini;
            $print_r($m_val);
            echo $s_preend.$s_rowend;
        }
        echo $s_infoend;
        return;
    }
}

?>