File tree Expand file tree Collapse file tree 5 files changed +43
-63
lines changed
Expand file tree Collapse file tree 5 files changed +43
-63
lines changed Original file line number Diff line number Diff line change 1+ <?php
2+
3+ namespace Pterodactyl \Extensions \Facades ;
4+
5+ use Illuminate \Support \Facades \Facade ;
6+
7+ class Theme extends Facade
8+ {
9+ /**
10+ * @return string
11+ */
12+ protected static function getFacadeAccessor ()
13+ {
14+ return 'extensions.themes ' ;
15+ }
16+ }
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ namespace Pterodactyl \Extensions \Themes ;
4+
5+ class Theme
6+ {
7+ public function js ($ path )
8+ {
9+ return sprintf ('<script src="%s"></script> ' . PHP_EOL , $ this ->getUrl ($ path ));
10+ }
11+
12+ public function css ($ path )
13+ {
14+ return sprintf ('<link media="all" type="text/css" rel="stylesheet" href="%s"/> ' . PHP_EOL , $ this ->getUrl ($ path ));
15+ }
16+
17+ protected function getUrl ($ path )
18+ {
19+ return '/themes/pterodactyl/ ' . ltrim ($ path , '/ ' );
20+ }
21+ }
Original file line number Diff line number Diff line change 1010use Illuminate \Support \Facades \Schema ;
1111use Illuminate \Support \ServiceProvider ;
1212use Pterodactyl \Observers \UserObserver ;
13+ use Pterodactyl \Extensions \Themes \Theme ;
1314use Pterodactyl \Observers \ServerObserver ;
1415use Pterodactyl \Observers \SubuserObserver ;
1516
@@ -40,6 +41,10 @@ public function register()
4041 if (! config ('pterodactyl.load_environment_only ' , false ) && $ this ->app ->environment () !== 'testing ' ) {
4142 $ this ->app ->register (SettingsServiceProvider::class);
4243 }
44+
45+ $ this ->app ->singleton ('extensions.themes ' , function () {
46+ return new Theme ;
47+ });
4348 }
4449
4550 /**
Original file line number Diff line number Diff line change 234234 'Schema ' => Illuminate \Support \Facades \Schema::class,
235235 'Session ' => Illuminate \Support \Facades \Session::class,
236236 'Storage ' => Illuminate \Support \Facades \Storage::class,
237+ 'Theme ' => Pterodactyl \Extensions \Facades \Theme::class,
237238 'URL ' => Illuminate \Support \Facades \URL ::class,
238239 'Validator ' => Illuminate \Support \Facades \Validator::class,
239240 'View ' => Illuminate \Support \Facades \View::class,
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments