p align="justify">}
$ files=config :: get ( log_files );
$ fp =fopen (self :: $ files [$ type], a + ); (! $ fp)
{
@ fclose ($ fp) ;;
}
$ str= raquo ;; (self :: $ logs [$ type] as $ data)
{
$ str.= MSG: . $ data [ msg ]. n raquo ;; (isset ($ data [ time ]))
{
$ str.= TIME: . $ data [ time ]. n raquo ;;
} (isset ($ data [ file ]))
{
$ str.= FILE: . $ data [ file ]. n raquo ;;
} (isset ($ data [ line ]))
{
$ str.= LINE: . $ data [ line ]. n raquo ;;
} (isset ($ data [ trace ]))
{
$ str.= TRACE: . $ data [ trace ]. n raquo ;;
}
$ str.= DATE: . $ data [ date ]. n raquo ;;
$ str.= URI: . $ data [ uri ]. n raquo ;;
$ str.= UID: . $ data [ uid ]. n n raquo ;;
} ($ fp, $ str); ($ fp);
}
} static function log_data ($ type, $ data)
{(! self :: $ enable)
{;
} (! isset ($ data [ msg ]) ||! $ data [ msg ])
{
$ data [ msg ]= No message specified! raquo ;;
} (! isset ($ data [ date ]))
{
$ data [ date ]=date ( Ymd H: i: s );
} (! isset ($ data [ uri ]) amp; amp; isset ($ _ SERVER [ REQUEST_URI ]))
{
$ data [ uri ]=$ _SERVER [ REQUEST_URI ];
} (! isset ($ data [ uid ]) amp; amp; isset ($ GLOBALS [ moifakultet_user_ID ]))
{
$ data [ uid ]=$ GLOBALS [ moifakultet_user_ID ];
} :: $ logs [$ type] []=$ data; true;
}
} tracer
{static $ enable=true; $ trace=array (); static function get_instance ()
{$ instance=null; (! $ instance)
{
$ instance=new tracer ();
} $ instance;
} static function add ($ class, $ data)
{(self :: $ enable)
{:: get_instance () - gt; add_entry ($ class, $ data);
}
} static function get ($ class)
{self :: get_instance () - gt; get_trace ($ class);
} function add_entry ($ class, $ data)
{(isset ($ this- gt; trace [$ class]))
{
$ this- gt; trace [$ class] []=$ data;
}
{
$ this- gt; trace [$ class]=array ($ data);
}
} function get_trace ($ class)
{$ this- gt; trace [$ class];
}
}