',
'
',
'
',
'
',
'
';
$this->addMessages();
echo
'
',
'
',
'
',
'';
}
public function addMessages()//doMessages
{
$logs = array_reverse( self::getLogs() );
array_walk( $logs, array( &$this, 'getMessage' ));//$this->messages
}
public function getMessage( $log, $id )
{
switch( $log['type'] )
{
case 'error' : case 'warning' :
$log['log'] = ucwords( $log['type'] ) . ' occurred at #' . esc_html( $id ) . ' - ' . esc_html( $log['log'] );
break;
case 'error2' :
$log['log'] = 'Error occurred - ' . esc_html( $log['log'] );
}
echo '' . $log['time'] . '' . $log['log'] . '.';
}
public function addLogs( $data )
{
$logs = self::getLogs();
foreach( $data as $k => $v )
{
$logs[] = wp_parse_args( $v, array( 'type' => 'notice', 'log' => '', 'time' => date( 'H:i', current_time( 'timestamp' ))));
}
$time = 24*60*60;
set_transient( 'mega_logs', $logs, $time );
}
public function getLogs()
{
$logs = get_transient( 'mega_logs' );
return is_array( $logs ) ? $logs : array();
}
}