Header();
try {
$this->Execute();
} catch ( Exception $ex ) {
$this->Message( get_class( $ex ) . ' [' . basename( $ex->getFile() ) . ':' . $ex->getLine() . ']: ' . $ex->getMessage() );
$this->Message( $ex->getTraceAsString(), true );
}
$this->Footer();
// Shutdown.
die();
}
/**
* Header.
*/
protected function Header() {
echo '
';
echo '';
echo '
';
echo '
';
echo '
';
echo '';
echo '';
flush();
}
/**
* Footer.
*/
protected function Footer() {
echo '';
flush();
}
/**
* Method: Execute.
*/
protected abstract function Execute();
/**
* Method: Shutdown.
*/
public function Shutdown() {
echo '
';
flush();
}
/**
* Method: Show progress.
*
* @param mixed $percent - Progress percentage.
*/
protected function Progress( $percent ) {
echo '';
flush();
}
/**
* Method: Message.
*
* @param string $message - Message.
* @param bool $sticky - True if sticky.
*/
protected function Message( $message, $sticky = false ) {
if ( $sticky ) {
echo '';
} else {
echo '';
}
flush();
}
}