note 71241 deleted from ref.classobj by felipe

From: Date: Mon, 10 Dec 2007 22:00:19 +0000
Subject: note 71241 deleted from ref.classobj by felipe
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-133324@lists.php.net to get a copy of this message
Note Submitter: Bardo ---- <? //this wil give you a nice view over your used classes. //in my config-file i've loaded my classes //this script gives you a class-diagram //still need to something about the javascript feature... //hope it helps you :) include("config.php"); function drawClass($c){ if($c['beschrijving']){ echo "<table style=\"background-color: #FFFFCC; border: 1px solid black;\">".$c['beschrijving']; } foreach($c as $k=>$sub){ if($k!="beschrijving"){ echo "<tr><td>"; drawClass($c[$k],($i+1)); echo "</td></tr>"; } } if($c['beschrijving']){ echo "</table><br>"; } } ?> <html> <head> <style> *{ font-family: Verdana; font-size: 10pt; } </style> <script> var mem=new Array(); function up(id){ if(!mem[id]) mem[id]=true; else mem[id]=false; if(mem[id]) document.getElementById(id).style.visibility="hidden"; else document.getElementById(id).style.visibility="visible"; } </script> </head> <body> <? $list=array(); $classes=get_declared_classes(); foreach($classes as $k=>$v){ $vars_p=array(); $meth_p=array(); $parent=array($v); $parent_tmp=$v; $target= &$list; while($parent_tmp=get_parent_class($parent_tmp)){ array_push($parent,$parent_tmp); $vars_p=array_merge($vars_p,get_class_vars($parent_tmp)); $meth_p=array_merge($meth_p,get_class_methods($parent_tmp)); } for($i=count($parent)-1;$i>=0;$i--){ if(!is_array($target[$parent[$i]])){ $target[$parent[$i]]=array(); } $target= &$target[$parent[$i]]; } $str="<tr><td style=\"background-color: #FFCC66;\"><button onclick=\"up('$v');\">UP</button>"; foreach($parent as $itt=>$p) $str.=($itt>0?"::":"").$p; $str.="</td></tr><tr><td>"; $str.="<table style=\"background-color: #FFFFCC; width: 300px;\" id=\"".$v."\">"; $vars=get_class_vars($v); foreach($vars as $l=>$w){ if(!is_numeric(array_search($l,array_keys($vars_p)))){ $str.="<tr><td>var ".$l.($w?"=".$w:"").";</td></tr>"; } } $meth=get_class_methods($v); foreach($meth as $l=>$w){ if(!is_numeric(array_search($w,$meth_p))){ $str.="<tr><td>function ".$w."(){}</td></tr>"; } } $str.="</table></td></tr>"; $target['beschrijving']=$str; } drawClass($list); ?> </body> </html>

« previous php.notes (#133324) next »