| 1 |
<?php |
| 2 |
/** |
| 3 |
* Plugin Name: Yatra - Travel Booking & Management |
| 4 |
* Plugin URI: https://wpyatra.com/ |
| 5 |
* Description: Tours and activities on WordPress — trips, bookings, PayPal and Pay Later, guest accounts, emails, reports. Yatra Pro adds premium gateways and modules. |
| 6 |
* Version: 3.0.2.6 |
| 7 |
* Requires at least: 6.0 |
| 8 |
* Requires PHP: 7.4 |
| 9 |
* Author: MantraBrain |
| 10 |
* Author URI: https://mantrabrain.com/ |
| 11 |
* License: GPL v2 or later |
| 12 |
* License URI: https://www.gnu.org/licenses/gpl-2.0.html |
| 13 |
* Text Domain: yatra |
| 14 |
* Domain Path: /i18n/languages |
| 15 |
*/ |
| 16 |
|
| 17 |
declare(strict_types=1); |
| 18 |
|
| 19 |
// Prevent direct access |
| 20 |
if (!defined('ABSPATH')) { |
| 21 |
exit; |
| 22 |
} |
| 23 |
|
| 24 |
require_once __DIR__ . '/includes/php-compat.php'; |
| 25 |
|
| 26 |
// Define plugin constants |
| 27 |
define('YATRA_PLUGIN_FILE', __FILE__); |
| 28 |
define('YATRA_PLUGIN_PATH', plugin_dir_path(__FILE__)); |
| 29 |
define('YATRA_PLUGIN_URL', plugin_dir_url(__FILE__)); |
| 30 |
define('YATRA_PLUGIN_BASENAME', plugin_basename(__FILE__)); |
| 31 |
define('YATRA_ABSPATH', plugin_dir_path(__FILE__)); |
| 32 |
define('YATRA_PLUGIN_URI', plugin_dir_url(__FILE__)); |
| 33 |
define('YATRA_VERSION', '3.0.2.6'); |
| 34 |
define('YATRA_MIN_PHP_VERSION', '7.4'); |
| 35 |
define('YATRA_MIN_WP_VERSION', '6.0'); |
| 36 |
|
| 37 |
// Deactivate incompatible Yatra Pro (< 3.0) and normalize plugin load order before Composer (prevents fatals from old Pro extending removed classes). |
| 38 |
require_once YATRA_PLUGIN_PATH . 'includes/incompatible-pro-guard.php'; |
| 39 |
yatra_run_incompatible_pro_guard(); |
| 40 |
|
| 41 |
// Load Composer autoloader |
| 42 |
$autoloader = YATRA_PLUGIN_PATH . 'vendor/autoload.php'; |
| 43 |
if (!file_exists($autoloader)) { |
| 44 |
wp_die( |
| 45 |
'Yatra plugin requires Composer dependencies. From the plugin directory run: composer install --no-dev --optimize-autoloader (or: composer run install:prod).', |
| 46 |
'Yatra Plugin Error', |
| 47 |
['back_link' => true] |
| 48 |
); |
| 49 |
} |
| 50 |
require_once $autoloader; |
| 51 |
|
| 52 |
// Check minimum requirements |
| 53 |
if (!\Yatra\Core\Requirements::check()) { |
| 54 |
return; |
| 55 |
} |
| 56 |
|
| 57 |
// Bootstrap the plugin |
| 58 |
try { |
| 59 |
if (!class_exists('Yatra\Bootstrap')) { |
| 60 |
throw new \Exception('Bootstrap class not found. Run composer install --no-dev --optimize-autoloader (or composer run install:prod) in the plugin directory.'); |
| 61 |
} |
| 62 |
|
| 63 |
$yatra = new \Yatra\Bootstrap(); |
| 64 |
$yatra->init(); |
| 65 |
|
| 66 |
} catch (Throwable $e) { |
| 67 |
// Use plain strings instead of translation functions to avoid early loading |
| 68 |
wp_die( |
| 69 |
sprintf( |
| 70 |
'Yatra plugin failed to initialize: %s', |
| 71 |
esc_html($e->getMessage()) |
| 72 |
), |
| 73 |
'Yatra Plugin Error', |
| 74 |
['back_link' => true] |
| 75 |
); |
| 76 |
} |
| 77 |
|
| 78 |
register_activation_hook(YATRA_PLUGIN_FILE, static function (): void { |
| 79 |
if (!function_exists('yatra_normalize_yatra_plugins_active_order')) { |
| 80 |
require_once YATRA_PLUGIN_PATH . 'includes/incompatible-pro-guard.php'; |
| 81 |
} |
| 82 |
yatra_normalize_yatra_plugins_active_order(); |
| 83 |
yatra_deactivate_incompatible_old_pro(); |
| 84 |
}); |
| 85 |
|