2022-01-05 18:11:00 -05:00
|
|
|
<?php
|
2022-01-30 18:02:52 -05:00
|
|
|
namespace App\Helpers;
|
2022-01-13 10:51:45 -05:00
|
|
|
|
2022-01-05 18:11:00 -05:00
|
|
|
class Misc {
|
2022-01-30 18:02:52 -05:00
|
|
|
static public function getCursor(): int {
|
|
|
|
return isset($_GET['cursor']) && is_numeric($_GET['cursor']) ? (int) $_GET['cursor'] : 0;
|
|
|
|
}
|
|
|
|
|
2022-03-11 17:24:13 -05:00
|
|
|
static public function getTtwid(): string {
|
2022-05-24 10:03:43 -04:00
|
|
|
return isset($_GET['cursor']) ? $_GET['cursor'] : '';
|
2022-03-11 17:24:13 -05:00
|
|
|
}
|
|
|
|
|
2022-03-29 13:30:31 -04:00
|
|
|
static public function url(string $endpoint = ''): string {
|
2022-03-29 13:37:57 -04:00
|
|
|
return self::env('APP_URL', '') . $endpoint;
|
2022-01-30 18:02:52 -05:00
|
|
|
}
|
|
|
|
|
2022-02-20 10:25:15 -05:00
|
|
|
static public function env(string $key, $default_value) {
|
2022-02-15 07:55:36 -05:00
|
|
|
return $_ENV[$key] ?? $default_value;
|
2022-01-05 18:11:00 -05:00
|
|
|
}
|
|
|
|
|
2022-01-28 09:54:09 -05:00
|
|
|
/**
|
|
|
|
* Returns absolute path for view
|
|
|
|
*/
|
2022-01-05 18:11:00 -05:00
|
|
|
static public function getView(string $template): string {
|
2022-11-04 13:02:57 -04:00
|
|
|
return __DIR__ . "/../../templates/views/{$template}.latte";
|
2022-01-05 18:11:00 -05:00
|
|
|
}
|
|
|
|
}
|