<?php
if ( ! defined( 'HOSTINGER_AI_WEBSITES_THEME_PATH' ) ) {
define( 'HOSTINGER_AI_WEBSITES_THEME_PATH', get_stylesheet_directory() );
}
if ( ! defined( 'HOSTINGER_AI_WEBSITES_ASSETS_URL' ) ) {
define( 'HOSTINGER_AI_WEBSITES_ASSETS_URL', get_stylesheet_directory_uri() . '/assets' );
}
if ( ! defined( 'HOSTINGER_AI_WEBSITES_WP_CONFIG_PATH' ) ) {
define( 'HOSTINGER_AI_WEBSITES_WP_CONFIG_PATH', ABSPATH . '.private/config.json' );
}
$hostinger_config = [];
if ( file_exists( HOSTINGER_AI_WEBSITES_WP_CONFIG_PATH ) ) {
$config_content = file_get_contents( HOSTINGER_AI_WEBSITES_WP_CONFIG_PATH );
$hostinger_config = json_decode( $config_content, true ) ?: [];
}
if ( ! defined( 'HOSTINGER_AI_WEBSITES_WP_TOKEN' ) ) {
$hostinger_dir_parts = explode( '/', __DIR__ );
$hostinger_server_root_path = '/' . $hostinger_dir_parts[1] . '/' . $hostinger_dir_parts[2];
define( 'HOSTINGER_AI_WEBSITES_WP_TOKEN', $hostinger_server_root_path . '/.api_token' );
}
if ( ! defined( 'HOSTINGER_AI_WEBSITES_REST_URI' ) ) {
$rest_uri = 'https://rest-hosting.hostinger.com';
if ( ! empty( $hostinger_config['base_rest_uri'] ) ) {
$rest_uri = $hostinger_config['base_rest_uri'];
}
define( 'HOSTINGER_AI_WEBSITES_REST_URI', $rest_uri );
}
if ( ! defined( 'HOSTINGER_WP_PROXY_API_URI' ) ) {
define( 'HOSTINGER_WP_PROXY_API_URI', 'https://wh-wordpress-proxy-api.hostinger.io' );
}
if ( ! defined( 'HOSTINGER_AI_WEBSITES_MINIMUM_PHP_VERSION' ) ) {
define( 'HOSTINGER_AI_WEBSITES_MINIMUM_PHP_VERSION', '8.0' );
}
if ( ! defined( 'HOSTINGER_AI_WEBSITES_REST_API_BASE' ) ) {
define( 'HOSTINGER_AI_WEBSITES_REST_API_BASE', 'hostinger-ai-plugin/v1' );
}
if ( ! version_compare( phpversion(), HOSTINGER_AI_WEBSITES_MINIMUM_PHP_VERSION, '>=' ) ) {
add_action( 'admin_notices', function () {
?>
<div class="notice notice-error is-dismissible hts-theme-settings">
<p>
<?php /* translators: %s php version */ ?>
<strong><?php echo __( 'Attention:', 'hostinger-ai-theme' ); ?></strong> <?php echo sprintf( __( 'The Hostinger Easy Onboarding plugin requires minimum PHP version of <b>%s</b>. ', 'hostinger-ai-theme' ), HOSTINGER_AI_WEBSITES_MINIMUM_PHP_VERSION ); ?>
</p>
<p>
<?php /* translators: %s php version */ ?>
<?php echo sprintf( __( 'You are running <b>%s</b> PHP version.', 'hostinger-ai-theme' ), phpversion() ); ?>
</p>
</div>
<?php
}
);
add_action( 'admin_head', function () { ?>
<style>
.notice.notice-error {
display: none !important;
}
.notice.notice-error.hts-theme-settings {
display: block !important;
}
</style>
<?php } );
} else {
$vendor_file = __DIR__ . DIRECTORY_SEPARATOR . 'vendor' . DIRECTORY_SEPARATOR . 'autoload.php';
if ( file_exists( $vendor_file ) ) {
require_once $vendor_file;
$boot = new \Hostinger\AiTheme\Boot();
$boot->run();
} else {
return;
}
}
// ============================================
// BedahCoding Custom CSS — injected by Webi
// ============================================
add_action('wp_enqueue_scripts', function() {
$css = "
/* Base typography */
body {
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif !important;
color: #333333;
font-size: 16px;
line-height: 1.6;
}
h1, h2, h3, h4, h5, h6,
.wp-block-heading {
color: #1eaace !important;
font-weight: 700;
}
h1 { font-size: 2.2rem !important; margin-bottom: 0.5em !important; }
h2 { font-size: 1.8rem !important; margin-bottom: 0.5em !important; }
h3 { font-size: 1.35rem !important; margin-bottom: 0.4em !important; }
h4 { font-size: 1.1rem !important; margin-bottom: 0.3em !important; }
/* Links */
a {
color: #1eaace !important;
text-decoration: none !important;
}
a:hover {
color: #1798ad !important;
text-decoration: underline !important;
}
/* Header / Navigation */
.site-header {
background: #1eaace !important;
color: #ffffff !important;
padding: 14px 0 !important;
box-shadow: 0 2px 8px rgba(0,0,0,0.12) !important;
}
.site-header a,
.site-header .site-title a,
.site-header a:hover,
.site-header .site-description {
color: #ffffff !important;
}
.site-header .site-title a {
font-weight: 700 !important;
font-size: 1.3rem !important;
}
/* Footer */
.site-footer {
background: #1eaace !important;
color: #ffffff !important;
padding: 36px 0 !important;
}
.site-footer a {
color: #ffffff !important;
}
.site-footer a:hover {
color: rgba(255,255,255,0.8) !important;
}
/* Hero / Cover blocks */
.wp-block-cover {
border-radius: 0 !important;
}
.wp-block-cover h1,
.wp-block-cover h2 {
color: #ffffff !important;
}
/* Button blocks */
.wp-block-button__link {
background: #1eaace !important;
border-radius: 8px !important;
padding: 12px 28px !important;
font-weight: 600 !important;
color: #ffffff !important;
border: 2px solid #1eaace !important;
transition: background 0.2s ease !important;
}
.wp-block-button__link:hover {
background: #1798ad !important;
border-color: #1798ad !important;
color: #ffffff !important;
}
/* Card / Group blocks */
.wp-block-group.has-white-background-color,
.wp-block-group.has-background {
border-radius: 12px !important;
}
.wp-block-group {
padding-top: 40px !important;
padding-bottom: 40px !important;
}
/* Table blocks */
.wp-block-table table {
border-collapse: collapse !important;
width: 100% !important;
}
.wp-block-table th {
background: #1eaace !important;
color: #ffffff !important;
padding: 12px 16px !important;
font-weight: 600 !important;
}
.wp-block-table td {
padding: 10px 16px !important;
border-bottom: 1px solid #eeeeee !important;
}
.wp-block-table tr:nth-child(even) td {
background: #f8f9fa !important;
}
/* List styles */
ul, ol {
padding-left: 24px !important;
}
li {
margin-bottom: 8px !important;
}
/* Paragraph spacing */
p {
line-height: 1.7 !important;
margin-bottom: 16px !important;
}
/* Align wide */
.alignwide {
max-width: 1100px !important;
margin-left: auto !important;
margin-right: auto !important;
}
";
wp_enqueue_style('hostinger-ai-theme', get_stylesheet_directory_uri() . '/assets/css/style.min.css');
wp_add_inline_style('hostinger-ai-theme', $css);
}, 999);