| 1 |
<?php |
| 2 |
/** |
| 3 |
* Submodule Loader and Initializer — gVectors News Module |
| 4 |
*/ |
| 5 |
|
| 6 |
use gVectors\News\NewsModule; |
| 7 |
use wpforo\modules\news\NewsConfig; |
| 8 |
|
| 9 |
// 1. Try to load the autoloader if the class isn't available yet |
| 10 |
if( ! class_exists( NewsModule::class ) ) { |
| 11 |
$autoloader = __DIR__ . '/../../admin/pages/news/vendor/autoload.php'; |
| 12 |
|
| 13 |
if( file_exists( $autoloader ) ) { |
| 14 |
require_once $autoloader; |
| 15 |
} |
| 16 |
} |
| 17 |
|
| 18 |
// 2. Safely instantiate the module only if both classes exist |
| 19 |
if( class_exists( NewsModule::class ) && class_exists( NewsConfig::class ) ) { |
| 20 |
new NewsModule( |
| 21 |
new NewsConfig( |
| 22 |
WPFORO_VERSION, |
| 23 |
WPFORO_BASEFOLDER, |
| 24 |
WPFORO_URL . '/admin/pages/news', |
| 25 |
'wpforo-addons', |
| 26 |
'wpforo_admin_base_menu' |
| 27 |
) |
| 28 |
); |
| 29 |
} else { |
| 30 |
// Logs a message to your server's debug.log if the files are missing |
| 31 |
error_log( 'wpForo News Error: The admin/pages/news submodule files are missing. Please clone the project recursively using: git clone --recurse-submodules <repository_url>' ); |
| 32 |
} |
| 33 |
|