68 lines
1.5 KiB
PHP
68 lines
1.5 KiB
PHP
<?php
|
|
/**
|
|
* @package ogre-suspension
|
|
* @author cleverogre
|
|
* @version 1.0.0
|
|
* @since 1.0.0
|
|
*/
|
|
|
|
namespace Ogre\Suspension;
|
|
|
|
use Ogre\Singleton;
|
|
use Ogre\Suspension;
|
|
|
|
defined('ABSPATH') || exit;
|
|
|
|
final class Template {
|
|
use Singleton;
|
|
|
|
protected function __construct() {
|
|
add_action('template_redirect', [$this, 'template_redirect']);
|
|
}
|
|
|
|
public function template_redirect():void {
|
|
$path = self::get_path();
|
|
if (file_exists($path)) {
|
|
include($path);
|
|
exit;
|
|
} else {
|
|
wp_die(Suspension::__('Site unavailable.'));
|
|
}
|
|
}
|
|
|
|
public static function get_path():string {
|
|
return Suspension::get_dir('templates/suspended.php');
|
|
}
|
|
|
|
public static function get_title():string {
|
|
return sprintf(
|
|
'%s - %s',
|
|
get_bloginfo('title'),
|
|
Suspension::__('Site Unavailable')
|
|
);
|
|
}
|
|
|
|
public static function the_title():void {
|
|
echo esc_html(self::get_title());
|
|
}
|
|
|
|
public static function get_image_url():string {
|
|
return Suspension::get_url('assets/logo.svg');
|
|
}
|
|
|
|
public static function get_image():string {
|
|
return sprintf(
|
|
'<img src="%s" alt="%s" width="206" height="150" />',
|
|
esc_url(self::get_image_url()),
|
|
Suspension::esc_attr__('CleverOgre Logo')
|
|
);
|
|
}
|
|
|
|
public static function the_image():void {
|
|
echo self::get_image();
|
|
}
|
|
|
|
}
|
|
|
|
Template::instance();
|