Wasting like <#DTT#> hrs and minutes here.. and no finish in sight

This commit is contained in:
Tobias Hopp 2020-08-05 06:00:56 +02:00
parent 98d5d2147e
commit 74d64f93ba
4 changed files with 19 additions and 6 deletions

View File

@ -7,11 +7,16 @@ require_once 'main.inc.php';
try try
{ {
$website = new website(); $website = new website();
$website->buildWebsite( language::$lang_file ); $content = $website->buildWebsite();
@ob_clean();
echo $content;
} catch( Exception $e ) } catch( Exception $e )
{ {
if( $e->getCode() === 201 ) if( $e->getCode() === 201 )
{ {
HTTPStatus( 503 );
echo 'We encountered an critical error.<br>The system file cannot be loaded!';
return;
} }
} }

View File

@ -57,7 +57,7 @@ class language
} }
} }
private static function setLangauge ( $a_language = 'en_en' ) private static function setLangauge ( $a_language = 'en_en' ): void
{ {
self::$lang = $a_language; self::$lang = $a_language;
setcookie( 'lang', $a_language, 0 ); setcookie( 'lang', $a_language, 0 );

View File

@ -1,6 +1,8 @@
<?php <?php
require_once 'config.inc.php'; require_once 'config.inc.php';
require_once 'language.class.inc.php';
require_once 'website.class.inc.php';
try try

View File

@ -8,15 +8,16 @@
class website class website
{ {
public $html = '';
public function buildWebsite( $a_languageFile ): void public function buildWebsite(): string
{ {
try try
{ {
$website = file_get_contents( __DIR__ . '/website.html' ); $website = file_get_contents( __DIR__ . '/website.html' );
$website = $this->replaceDefaultThings( $website ); $website = $this->replaceDefaultThings( $website );
$website = $this->setQuestions( $website );
return $website;
} catch( Exception $e ) } catch( Exception $e )
{ {
@ -24,7 +25,7 @@ class website
} }
} }
public function replaceDefaultThings( $website ) private function replaceDefaultThings( $website )
{ {
$website = str_replace( $website = str_replace(
array( array(
@ -42,4 +43,9 @@ class website
), $website ); ), $website );
return $website; return $website;
} }
private function setQuestions( $website ) : string
{
return $website; // todo
}
} }