<?php
/**
 * Plugin Name: WordPress Booking Event
 * Plugin URI: http://booking.cmsmart.net/
 * Description: WordPress Booking Event Pro is a plugin developed for travel agencies and tour operators of all sizes. With this plugin, you can create customized itineraries & travel packages quickly.
 * Version: 1.3.0
 * Author: NetBase Team
 * Author URI: https://netbaseteam.com
 * Text Domain: wpbookingevent
**/

use WpBookingEvent\Application\Application as ApplicationAlias;
use WpBookingEvent\Factory as FactoryAlias;

define("DS",DIRECTORY_SEPARATOR);
define("WPBOOKINGEVENT_PATH_ROOT",plugin_dir_path(__FILE__));
define("_WPBOOKINGEVENT_EXEC",1);
define("WPBOOKINGEVENT_PREFIX_TABLE","woobooking_");
define("WPBOOKINGEVENT_MINIMUM_ELEMENTOR_VERSION","2.0.0");
define("WPBOOKINGEVENT_MINIMUM_PHP_VERSION","7.0");
define("WPBOOKINGEVENT_ADMIN_PATH",WPBOOKINGEVENT_PATH_ROOT.DS."admin");
define("WPBOOKINGEVENT_FRONTEND_PATH",WPBOOKINGEVENT_PATH_ROOT.DS."frontend");
define("WPBOOKINGEVENT_PLUGIN_DIR_URL",plugin_dir_url(__FILE__));
define("WPBOOKINGEVENT_SITE_URL",get_site_url());
require_once WPBOOKINGEVENT_PATH_ROOT.DS."wpbookingeventconfig.php";
require_once WPBOOKINGEVENT_PATH_ROOT.DS."NBAppHelper.php";
// Check for required Elementor version
if(file_exists(ABSPATH . 'wp-content/plugins/elementor/elementor.php'))
{
    include_once( ABSPATH . 'wp-content/plugins/elementor/elementor.php' );
}

/**
 * Class wpbookingevent
 */
class wpbookingevent
{

    public static function init()
    {
        $url="https://developer.wordpress.org/reference/functions/wp_redirect/";
        require_once __DIR__."/vendor/autoload.php";
        $input= FactoryAlias::getInput();
        $clientId=is_admin()?1:0;
        $data=$input->getData();
        $uri= FactoryAlias::getUri();
        $path=$uri->getPath();
        if(strpos($path,"wpbookingevent_backend")!==false){
            $clientId=1;
        }

        if($clientId==1){
            require_once __DIR__."/admin/includes/defined.php";
        }else{
            require_once __DIR__."/frontend/includes/defined.php";
        }
        $app=ApplicationAlias::getInstance($clientId);
        $app->execute();

    }
}

wpbookingevent::init();
if(!function_exists("wpbookingevent_get_content")) {
    function wpbookingevent_render_content($content)
    {
        echo (wpbookingevent_get_content($content));
    }
}
if(!function_exists("wpbookingevent_get_content")) {
    function wpbookingevent_get_content($content)
    {
        return $content;
    }
}