16 DEFINE(
'ERROR' ,
'error' );
17 DEFINE(
'NOTIFICATION' ,
'notification' );
18 DEFINE(
'COMMON' ,
'common' );
19 DEFINE(
'QUERY' ,
'query' );
96 $this->CachedMultyFS =
get_package(
'cached_multy_fs' ,
'last' , __FILE__ );
97 $this->String =
get_package(
'string' ,
'last' , __FILE__ );
100 ERROR =>
'trace_line_error.tpl' , COMMON =>
'trace_line_common.tpl' ,
101 NOTIFICATION =>
'trace_line_notification.tpl' , QUERY =>
'trace_line_query.tpl' ,
102 'start_group' =>
'trace_start_group.tpl' ,
'end_group' =>
'trace_end_group.tpl'
105 foreach( $Data as $Key => $Value )
107 $this->Templates[ $Key ] = $this->CachedMultyFS->get_template( __FILE__ , $Value );
110 catch( Exception $e )
142 if( $this->StoreTrace )
144 $Template = str_replace(
'{string}' , $Str , $this->Templates[ $Type ] );
146 $this->TraceStrings [] = array(
'name' =>
'string' ,
'content' => $Template );
149 catch( Exception $e )
177 if( $this->StoreTrace )
179 $Template = str_replace(
'{string}' , $Str , $this->Templates[
'start_group' ] );
180 $Template = str_replace(
'{i}' , count( $this->TraceStrings ) , $Template );
182 $this->TraceStrings [] = array(
'name' =>
'start_group' ,
'content' => $Template );
185 catch( Exception $e )
213 if( $this->StoreTrace )
215 for( $i = 0 ; $i < $Count ; $i++ )
217 $this->TraceStrings [] = array(
218 'name' =>
'end_group' ,
'content' => $this->Templates[
'end_group' ]
223 catch( Exception $e )
251 if( $this->StoreTrace )
255 'umx_action' ,
"action_name , time , info" ,
256 "'".htmlspecialchars( $ActionName , ENT_QUOTES ).
"', NOW() ,'".
257 htmlspecialchars( $ActionDescription , ENT_QUOTES ).
"'"
261 catch( Exception $e )
285 private function remove_empty_leaves()
291 for( $i = 0 ; $i < count( $this->TraceStrings ) ; )
293 if(
get_field( $this->TraceStrings[ $i ] ,
'name' ) ==
'start_group' &&
294 get_field( $this->TraceStrings[ $i + 1 ] ,
'name' ) ==
'end_group' )
297 array_splice( $this->TraceStrings , $i , 2 );
307 catch( Exception $e )
327 private function remove_empty_tags()
331 for( ; $this->remove_empty_leaves() ; );
333 catch( Exception $e )
357 private function compile_trace_items()
361 $this->remove_empty_tags();
363 $Output = $this->CachedMultyFS->get_template( __FILE__ ,
'trace_start.tpl' );
364 $Output .=
implode_ex(
'' , $this->TraceStrings ,
'content' );
365 $Output .= $this->CachedMultyFS->get_template( __FILE__ ,
'trace_end.tpl' );
366 $Output = str_replace(
367 '{output}' , $Output , $this->CachedMultyFS->get_template( __FILE__ ,
'trace.tpl' )
372 catch( Exception $e )
400 if( $this->StoreTrace )
402 $Output = $this->compile_trace_items();
404 $TraceBlock = $this->CachedMultyFS->get_template( __FILE__ ,
'trace_block.tpl' );
405 $TraceBlock = str_replace(
'{output}' , $Output , $TraceBlock );
407 return( $TraceBlock );
411 return(
'{lang:trace_switched_off}' );
414 catch( Exception $e )
444 catch( Exception $e )