PluginProbe
Yatra – Travel Booking & Tour Operator Software / 3.0.16
Yatra – Travel Booking & Tour Operator Software v3.0.16
3.0.16 3.0.15 3.0.14 3.0.14.1 3.0.14.2 3.0.12 3.0.13 3.0.11 3.0.10 3.0.9 3.0.8 3.0.7 3.0.6 3.0.5 3.0.5.1 3.0.4 3.0.3 3.0.2.9 3.0.2.7 3.0.2.8 3.0.2.6 trunk 1.0.0 2.0.0 2.0.1 All 84 releases
← All changes | yatra.php +89 -60 2.0.1 → 3.0.16 View file →
@@ -1,60 +1,89 @@
1 -<?php
2 -/**
3 - * Plugin Name: Yatra - Complete Travel & Tour Booking System
4 - * Plugin URI: https://mantrabrain.com/downloads/yatra-wordpress-travel-booking-system/?utm_source=wordpress&utm_medium=wppage&utm_campaign=wporg
5 - * Description: Yatra is a free travel & tour booking WordPress plugin to create travel and tour packages for tour operators and travel agencies.
6 - * Version: 2.0.1
7 - * Author: Mantrabrain
8 - * Author URI: https://mantrabrain.com/
9 - * License: GPL-2.0+
10 - * License URI: http://www.gnu.org/licenses/gpl-2.0.txt
11 - * Text Domain: yatra
12 - * Domain Path: /languages
13 - */
14 -
15 -if (!defined('ABSPATH')) {
16 - exit; // Exit if accessed directly.
17 -}
18 -
19 -// Define YATRA_PLUGIN_FILE.
20 -if (!defined('YATRA_FILE')) {
21 - define('YATRA_FILE', __FILE__);
22 -}
23 -
24 -// Define YATRA_VERSION.
25 -if (!defined('YATRA_VERSION')) {
26 - define('YATRA_VERSION', '2.0.1');
27 -}
28 -
29 -// Define YATRA_PLUGIN_URI.
30 -if (!defined('YATRA_PLUGIN_URI')) {
31 - define('YATRA_PLUGIN_URI', plugins_url('', YATRA_FILE));
32 -}
33 -
34 -// Define YATRA_PLUGIN_DIR.
35 -if (!defined('YATRA_PLUGIN_DIR')) {
36 - define('YATRA_PLUGIN_DIR', plugin_dir_path(YATRA_FILE));
37 -}
38 -
39 -
40 -// Include the main Yatra class.
41 -if (!class_exists('Yatra')) {
42 - include_once dirname(__FILE__) . '/includes/class-yatra.php';
43 -}
44 -
45 -
46 -/**
47 - * Main instance of Yatra.
48 - *
49 - * Returns the main instance of Yatra to prevent the need to use globals.
50 - *
51 - * @since 1.0.0
52 - * @return Yatra
53 - */
54 -function yatra_instance()
55 -{
56 - return Yatra::instance();
57 -}
58 -
59 -// Global for backwards compatibility.
60 -$GLOBALS['yatra-instance'] = yatra_instance();
1 +<?php
2 +/**
3 + * Plugin Name: Yatra - Travel Booking & Tour Operator Software
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.16
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.16');
34 +define('YATRA_MIN_PHP_VERSION', '7.4');
35 +define('YATRA_MIN_WP_VERSION', '6.0');
36 +
37 +/** Sample / preview email verification URL segment (not a real token). */
38 +if (!defined('YATRA_EMAIL_VERIFICATION_PREVIEW_TOKEN')) {
39 + define('YATRA_EMAIL_VERIFICATION_PREVIEW_TOKEN', 'preview-verify-token');
40 +}
41 +
42 +// Deactivate incompatible Yatra Pro (&lt; 3.0) and normalize plugin load order before Composer (prevents fatals from old Pro extending removed classes).
43 +require_once YATRA_PLUGIN_PATH . 'includes/incompatible-pro-guard.php';
44 +yatra_run_incompatible_pro_guard();
45 +
46 +// Load Composer autoloader
47 +$autoloader = YATRA_PLUGIN_PATH . 'vendor/autoload.php';
48 +if (!file_exists($autoloader)) {
49 + wp_die(
50 + 'Yatra plugin requires Composer dependencies. From the plugin directory run: composer install --no-dev --optimize-autoloader (or: composer run install:prod).',
51 + 'Yatra Plugin Error',
52 + ['back_link' => true]
53 + );
54 +}
55 +require_once $autoloader;
56 +
57 +// Check minimum requirements
58 +if (!\Yatra\Core\Requirements::check()) {
59 + return;
60 +}
61 +
62 +// Bootstrap the plugin
63 +try {
64 + if (!class_exists('Yatra\Bootstrap')) {
65 + throw new \Exception('Bootstrap class not found. Run composer install --no-dev --optimize-autoloader (or composer run install:prod) in the plugin directory.');
66 + }
67 +
68 + $yatra = new \Yatra\Bootstrap();
69 + $yatra->init();
70 +
71 +} catch (Throwable $e) {
72 + // Use plain strings instead of translation functions to avoid early loading
73 + wp_die(
74 + sprintf(
75 + 'Yatra plugin failed to initialize: %s',
76 + esc_html($e->getMessage())
77 + ),
78 + 'Yatra Plugin Error',
79 + ['back_link' => true]
80 + );
81 +}
82 +
83 +register_activation_hook(YATRA_PLUGIN_FILE, static function (): void {
84 + if (!function_exists('yatra_normalize_yatra_plugins_active_order')) {
85 + require_once YATRA_PLUGIN_PATH . 'includes/incompatible-pro-guard.php';
86 + }
87 + yatra_normalize_yatra_plugins_active_order();
88 + yatra_deactivate_incompatible_old_pro();
89 +});