init.php
34 lines
| 1 | <?php |
| 2 | |
| 3 | /** |
| 4 | * EmbedPress Core Initialization |
| 5 | * |
| 6 | * This file initializes core EmbedPress functionality including the asset manager |
| 7 | */ |
| 8 | |
| 9 | use EmbedPress\Core\AssetManager; |
| 10 | use EmbedPress\Core\LocalizationManager; |
| 11 | use EmbedPress\Includes\Classes\Pdf_Thumbnail_Handler; |
| 12 | |
| 13 | // Prevent direct access |
| 14 | if (!defined('ABSPATH')) { |
| 15 | exit; |
| 16 | } |
| 17 | |
| 18 | // Include the AssetManager and LocalizationManager classes |
| 19 | require_once EMBEDPRESS_PLUGIN_DIR_PATH . 'Core/AssetManager.php'; |
| 20 | require_once EMBEDPRESS_PLUGIN_DIR_PATH . 'Core/LocalizationManager.php'; |
| 21 | |
| 22 | // Include Analytics class |
| 23 | require_once EMBEDPRESS_PATH_BASE . 'EmbedPress/Analytics/Analytics.php'; |
| 24 | |
| 25 | // Initialize AssetManager and LocalizationManager when WordPress is ready |
| 26 | add_action('init', function() { |
| 27 | AssetManager::init(); |
| 28 | LocalizationManager::init(); |
| 29 | // Generates a poster image once per PDF upload so every render surface can |
| 30 | // read a cached thumbnail instead of rasterising page 1 in the visitor's |
| 31 | // browser on every page view (FB #84167). |
| 32 | Pdf_Thumbnail_Handler::init(); |
| 33 | }, 5); // Early priority to ensure it's loaded before other components |
| 34 |