yoursecretsareours/website.class.inc.php

51 lines
1.5 KiB
PHP

<?php
/**
* Class website
* 2xx error codes
*/
class website
{
public function buildWebsite(): string
{
try
{
$website = file_get_contents( __DIR__ . '/website.html' );
$website = $this->replaceDefaultThings( $website );
$website = $this->setQuestions( $website );
return $website;
} catch( Exception $e )
{
throw new RuntimeException( 'Cannot load the website.html file', 201 );
}
}
private function replaceDefaultThings( $website )
{
$website = str_replace(
array(
'[LANG]', '[TITLE]', '[MAIN_TITLE]', '[DESCRIPTION]', '[PROJECT_DESCRIPTION]', '[HELP_US]', '[REQUEST_MORE]','[SOCIAL_MEDIA]', '[JOIN_DISCORD]' ),
array(
substr( language::$lang, 0, 2 ),
language::$lang_file[language::TITLE],
language::$lang_file[language::MAIN_TITLE],
language::$lang_file[language::DESCRIPTION],
language::$lang_file[language::PROJECT_DESCRIPTION],
language::$lang_file[language::HELP_US],
language::$lang_file[language::REQUEST_MORE],
language::$lang_file[language::SOCIAL_MEDIA],
language::$lang_file[language::JOIN_DISCORD]
), $website );
return $website;
}
private function setQuestions( $website ) : string
{
return $website; // todo
}
}