-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6fa2d5f
commit 7879e68
Showing
5 changed files
with
105 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<?php | ||
|
||
namespace BNETDocs\Controllers; | ||
|
||
use \BNETDocs\Models\Discord as DiscordModel; | ||
|
||
use \CarlBennett\MVC\Libraries\Common; | ||
use \CarlBennett\MVC\Libraries\Controller; | ||
use \CarlBennett\MVC\Libraries\Router; | ||
use \CarlBennett\MVC\Libraries\View; | ||
|
||
use \DateTime; | ||
use \DateTimeZone; | ||
|
||
class Discord extends Controller { | ||
|
||
public function &run( Router &$router, View &$view, array &$args ) { | ||
|
||
$model = new DiscordModel(); | ||
|
||
$model->discord_url = 'https://discord.gg/'; | ||
$model->discord_url .= Common::$config->bnetdocs->discord->invite_code; | ||
$model->discord_server_id = Common::$config->bnetdocs->discord->server_id; | ||
|
||
$view->render( $model ); | ||
|
||
$model->_responseCode = 200; | ||
$model->_responseHeaders[ 'Content-Type' ] = $view->getMimeType(); | ||
$model->_responseTTL = 0; | ||
|
||
return $model; | ||
|
||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<?php | ||
|
||
namespace BNETDocs\Models; | ||
|
||
use \CarlBennett\MVC\Libraries\Model; | ||
|
||
class Discord extends Model { | ||
|
||
public $discord_url; | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<?php | ||
|
||
namespace BNETDocs\Templates; | ||
|
||
use \CarlBennett\MVC\Libraries\Common; | ||
use \CarlBennett\MVC\Libraries\Pair; | ||
|
||
$title = 'Discord'; | ||
$description = 'Join our Discord and have a chat with us!'; | ||
|
||
$this->opengraph->attach( new Pair( 'url', '/discord' )); | ||
$this->opengraph->attach( new Pair( 'type', 'article' )); | ||
|
||
$this->additional_css[] = "/a/forms.css"; | ||
require( './header.inc.phtml' ); | ||
?> | ||
<article> | ||
<header>Discord</header> | ||
<section> | ||
<h2>Who's Online</h2><br/> | ||
<iframe style="display:block;margin:auto;" src="https://discordapp.com/widget?id=<?=filter_var( $this->getContext()->discord_server_id, FILTER_SANITIZE_FULL_SPECIAL_CHARS )?>&theme=dark" width="80%" height="400" allowtransparency="true" frameborder="0"></iframe> | ||
<h2>What is Discord?</h2><br/> | ||
<p><a href="https://discordapp.com/">Discord</a> is a free voice, video, and text chat app made for gamers.</p> | ||
<p>The Discord app can be accessed on PCs, browsers, and mobile phones. Users can direct message other users and congregate by joining servers.</p> | ||
<p>From small to large communities, millions of users are using Discord to chat securely in real-time. BNETDocs is no exception.</p> | ||
<h2>How to Join</h2> | ||
<p style="text-align:center;"><a class="button" href="<?php echo Common::relativeUrlToAbsolute( $this->getContext()->discord_url ); ?>">Click this invite link</a></p> | ||
<p><strong><a href="<?php echo Common::relativeUrlToAbsolute( $this->getContext()->discord_url ); ?>">Join our Discord</a></strong> and chat with other gamers like you! Our community is open to the public and we welcome new users.</p> | ||
</section> | ||
</article> | ||
<?php require( './footer.inc.phtml' ); ?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<?php | ||
|
||
namespace BNETDocs\Views; | ||
|
||
use \BNETDocs\Models\Discord as DiscordModel; | ||
|
||
use \CarlBennett\MVC\Libraries\Exceptions\IncorrectModelException; | ||
use \CarlBennett\MVC\Libraries\Model; | ||
use \CarlBennett\MVC\Libraries\Template; | ||
use \CarlBennett\MVC\Libraries\View; | ||
|
||
class DiscordHtml extends View { | ||
|
||
public function getMimeType() { | ||
return 'text/html;charset=utf-8'; | ||
} | ||
|
||
public function render( Model &$model ) { | ||
if ( !$model instanceof DiscordModel ) { | ||
throw new IncorrectModelException(); | ||
} | ||
( new Template( $model, 'Discord' ))->render(); | ||
} | ||
|
||
} |