nuke_emojis();
// Prepare assets and original data.
$this->enqueue_setup_assets();
// Clean any previous output buffer.
if (ob_get_length()) {
ob_clean();
}
/**
* Start building the page manually to avoid StoreEngine Fatal Errors.
*/
?>
>
$url) {
if (false !== strpos($url, '/images/core/emoji')) {
unset($urls[$key]);
}
}
}
return $urls;
}, 10, 2);
}
/**
* Enqueue Build Assets with Versioned JS and all original localized data.
*/
private function enqueue_setup_assets()
{
$asset_file = GAMEENGINE_PATH . 'assets/build/setup.asset.php';
if (! file_exists($asset_file)) {
return;
}
$asset_data = require $asset_file;
// Enqueue Wizard CSS
wp_enqueue_style(
'gameengine-setup-style',
GAMEENGINE_URL . 'assets/build/setup.css',
array('wp-components'),
$asset_data['version']
);
// Enqueue Wizard JS. It had no translations loaded at all; it now takes
// them from the same companion as the admin app.
$dependencies = $asset_data['dependencies'];
$i18n_handle = \GameEngine\Assets::register_i18n_strings();
if ($i18n_handle) {
$dependencies[] = $i18n_handle;
}
wp_enqueue_script(
'gameengine-setup-script',
GAMEENGINE_URL . 'assets/build/setup.js',
$dependencies,
$asset_data['version'],
true
);
// --- RESTORED ALL YOUR ORIGINAL DATA ---
$setup_data = array(
'rest_url' => rest_url('gameengine/v1'),
'nonce' => wp_create_nonce('wp_rest'),
'admin_url' => admin_url(),
'gameengine_nonce' => wp_create_nonce('gameengine_nonce'),
'namespace' => 'gameengine/v1/',
'plugin_root_url' => GAMEENGINE_URL,
'plugin_root_path' => GAMEENGINE_PATH,
'ajaxurl' => esc_url(admin_url('admin-ajax.php')),
'site_url' => site_url(),
'admin_url' => admin_url(),
'is_woocommerce_active' => \GameEngine\Helper::is_plugin_active('WooCommerce'),
'is_academylms_active' => \GameEngine\Helper::is_academylms_active(),
'is_tutorlms_active' => \GameEngine\Helper::is_tutorlms_active(),
'is_storeengine_active' => defined('STOREENGINE_VERSION'),
'banners' => array(
'points' => get_option('gameengine_hide_banner_points', 'no'),
'achievements' => get_option('gameengine_hide_banner_achievements', 'no'),
'levels' => get_option('gameengine_hide_banner_levels', 'no'),
),
);
wp_localize_script('gameengine-setup-script', 'GameEngineGlobal', $setup_data);
}
}