<?php
/**
 * Start the addons.
 *
 * Check every uap addon. if the utilities class exists and not passing the 'canRun' its because of uap Pro version.
 * Remove the admin error notifications.
 *
 */
 // Affiliate own referrals.
 if ( class_exists( '\UapAor\Utilities' ) ) {
   global $UapAorPublic;
   if ( $UapAorPublic === null ) {
     if ( is_admin() ){
       remove_action( 'admin_notices', [ 'UapAor\Utilities', 'adminNotice' ] );
       remove_action( 'admin_notices', [ 'UapAor\Utilities', 'adminNoticeVersion' ] );
       $UapAorAdmin = new \UapAor\Admin\Main();
     }
     $UapAorPublic = new \UapAor\Main();
   }
 }
 // Anchor link.
 if ( class_exists( '\UapAl\Utilities' ) ){
   global $UapAl;
   if ( $UapAl === null ) {
     $pluginSettings = new \UapAl\Settings();
     $viewObject = new \UapAl\View();
     if ( is_admin() ){
       remove_action( 'admin_notices', [ 'UapAl\Utilities', 'adminNotice' ] );
       remove_action( 'admin_notices', [ 'UapAl\Utilities', 'adminNoticeVersion' ] );
       $UapAlAdmin = new \UapAl\Admin\Main( $pluginSettings->get(), $viewObject );
     }
     $UapAl = new \UapAl\Main( $pluginSettings->get(), $viewObject );
   }
 }

 // Bitly.
 if ( class_exists( '\UapBitLy\Utilities' ) ){
   global $UapBitLyAdmin;
   if ( $UapBitLyAdmin === null ) {
     $pluginSettings = new \UapBitLy\Settings();
     $viewObject = new \UapBitLy\View();
     if ( is_admin() ){
       remove_action( 'admin_notices', [ 'UapBitLy\Utilities', 'adminNotice' ] );
       remove_action( 'admin_notices', [ 'UapBitLy\Utilities', 'adminNoticeVersion' ] );
       $UapBitLyAdmin = new \UapBitLy\Admin\Main( $pluginSettings->get(), $viewObject );
     }
     $UapBitLy = new \UapBitLy\Main( $pluginSettings->get(), $viewObject );
  }
 }

 // Contact form 7.
 if ( class_exists( '\UapCf7T\Utilities' ) ){
   global $UapCf7T;
   if ( $UapCf7T === null ) {
     $pluginSettings = new \UapCf7T\Settings();
     $viewObject = new \UapCf7T\View();
     if ( is_admin() ){
       remove_action( 'admin_notices', [ 'UapCf7T\Utilities', 'adminNotice' ] );
       remove_action( 'admin_notices', [ 'UapCf7T\Utilities', 'adminNoticeVersion' ] );
       $UapCf7TAdmin = new \UapCf7T\Admin\Main( $pluginSettings->get(), $viewObject );
     }
     $UapCf7T = new \UapCf7T\Main( $pluginSettings->get(), $viewObject );
   }
 }

 // Dokan.
 if ( class_exists( '\UapDokan\Utilities' ) ){
   global $UapDokan;
   if ( $UapDokan === null ) {
     $pluginSettings = new \UapDokan\Settings();
     $viewObject = new \UapDokan\View();
     if ( is_admin() ){
       remove_action( 'admin_notices', [ 'UapDokan\Utilities', 'adminNotice' ] );
       remove_action( 'admin_notices', [ 'UapDokan\Utilities', 'adminNoticeVersion' ] );
       $UapDokanAdmin = new \UapDokan\Admin\Main( $pluginSettings->get(), $viewObject );
     }
     $UapDokan = new \UapDokan\Main( $pluginSettings->get(), $viewObject );
   }
 }

 // Exchange rate for custom currency.
 if ( class_exists( '\UapExchange\Utilities' ) ){
   global $UapExchange;
   if ( $UapExchange === null ) {
     $pluginSettings = new \UapExchange\Settings();
     $viewObject = new \UapExchange\View();
     if ( is_admin() ){
       remove_action( 'admin_notices', [ 'UapExchange\Utilities', 'adminNotice' ] );
       remove_action( 'admin_notices', [ 'UapExchange\Utilities', 'adminNoticeVersion' ] );
       $UapExchangeAdmin = new \UapExchange\Admin\Main( $pluginSettings->get(), $viewObject );
     }
     $UapExchange = new \UapExchange\Main( $pluginSettings->get(), $viewObject );
   }
 }

 // Extended Shortcodes.
 if ( class_exists( '\UapESh\Utilities' ) ){
   global $UapESh;
   if ( $UapESh === null ) {
     $pluginSettings = new \UapESh\Settings();
     $viewObject = new \UapESh\View();
     if ( is_admin() ){
       remove_action( 'admin_notices', [ 'UapESh\Utilities', 'adminNotice' ] );
       remove_action( 'admin_notices', [ 'UapESh\Utilities', 'adminNoticeVersion' ] );
       $UapEShAdmin = new \UapESh\Admin\Main( $pluginSettings->get(), $viewObject );
     }
     $UapESh = new \UapESh\Main( $pluginSettings->get(), $viewObject );
   }
 }

 // One Time Reward.
 if ( class_exists( '\UapOtr\Utilities' ) ){
   global $uapKit;// in older version of uapOtr the main variable its uapKit.
   if ( $uapKit === null ) {
     $pluginSettings = new \UapOtr\Settings();
     $viewObject = new \UapOtr\View();
     if ( is_admin() ){
       remove_action( 'admin_notices', [ 'UapOtr\Utilities', 'adminNotice' ] );
       remove_action( 'admin_notices', [ 'UapOtr\Utilities', 'adminNoticeVersion' ] );
       $UapOtrAdmin = new \UapOtr\Admin\Main( $pluginSettings->get(), $viewObject );
     }
     $UapOtrAdmin = new \UapOtr\Main( $pluginSettings->get(), $viewObject );
   }
 }

 // Extension Kit.
 if ( class_exists( '\UapKit\Utilities' ) ){
   global $uapKit;
   if ( $uapKit === null ) {
     $pluginSettings = new \UapKit\Settings();
     $viewObject = new \UapKit\View();
     if ( is_admin() ){
       remove_action( 'admin_notices', [ 'UapKit\Utilities', 'adminNotice' ] );
       remove_action( 'admin_notices', [ 'UapKit\Utilities', 'adminNoticeVersion' ] );
       $uapKitAdmin = new \UapKit\Admin\Main( $pluginSettings->get(), $viewObject );
     }
     $uapKit = new \UapKit\Main( $pluginSettings->get(), $viewObject );
   }
 }

 // Fraud Protection.
 if ( class_exists( '\UapFp\Utilities' ) ){
   global $UapFpPublic;
   if ( $UapFpPublic === null ) {
     if ( is_admin() ){
       remove_action( 'admin_notices', [ 'UapFp\Utilities', 'adminNotice' ] );
       remove_action( 'admin_notices', [ 'UapFp\Utilities', 'adminNoticeVersion' ] );
       $UapFpAdmin = new \UapFp\Admin\Main();
     }
     $UapFpPublic = new \UapFp\Main();
   }
 }

 // Import Referrals.
 if ( class_exists( '\UapIR\Utilities' ) ){
   global $UapIR;
   if ( $UapIR === null ) {
     $pluginSettings = new \UapIR\Settings();
     $viewObject = new \UapIR\View();
     if ( is_admin() ){
       remove_action( 'admin_notices', [ 'UapIR\Utilities', 'adminNotice' ] );
       remove_action( 'admin_notices', [ 'UapIR\Utilities', 'adminNoticeVersion' ] );
       $UapIRAdmin = new \UapIR\Admin\Main( $pluginSettings->get(), $viewObject );
     }
     $UapIR = new \UapIR\Main( $pluginSettings->get(), $viewObject );
   }
 }

 // Invite Your Friends.
 if ( class_exists( '\UapIyf\Utilities' ) ){
   global $UapIyfPublic;
   if ( $UapIyfPublic === null ) {
     if ( is_admin() ){
       remove_action( 'admin_notices', [ 'UapIyf\Utilities', 'adminNotice' ] );
       remove_action( 'admin_notices', [ 'UapIyf\Utilities', 'adminNoticeVersion' ] );
       $UapIyfAdmin = new \UapIyf\Admin\Main();
     }
     $UapIyfPublic = new \UapIyf\Main();
   }
 }

 // IP Restrictions.
 if ( class_exists( '\UapIpr\Utilities' ) ){
   global $uapIprPublic;
   if ( $uapIprPublic === null ) {
     if ( is_admin() ){
       remove_action( 'admin_notices', [ 'UapIpR\Utilities', 'adminNotice' ] );
       remove_action( 'admin_notices', [ 'UapIpR\Utilities', 'adminNoticeVersion' ] );
       $uapIprAdmin = new \UapIpr\Admin\Main();
     }
     $uapIprPublic = new \UapIpr\Main();
   }
 }

 // Manage reset password.
 if ( class_exists( '\UapMrp\Utilities' ) ){
   global $UapMrp;
   if ( $UapMrp === null ) {
     $pluginSettings = new \UapMrp\Settings();
     $viewObject = new \UapMrp\View();
     if ( is_admin() ){
       remove_action( 'admin_notices', [ 'UapMrp\Utilities', 'adminNotice' ] );
       remove_action( 'admin_notices', [ 'UapMrp\Utilities', 'adminNoticeVersion' ] );
       $UapMrpAdmin = new \UapMrp\Admin\Main( $pluginSettings->get(), $viewObject );
     }
     $UapMrp = new \UapMrp\Main( $pluginSettings->get(), $viewObject );
   }
 }

 // MLM Based On Product Price.
 if ( class_exists( '\UapMlmPp\Utilities' ) ){
   global $uapMlmPpPublic;
   if ( $uapMlmPpPublic === null ) {
     if ( is_admin() ){
       remove_action( 'admin_notices', [ 'UapMlmPp\Utilities', 'adminNotice' ] );
       remove_action( 'admin_notices', [ 'UapMlmPp\Utilities', 'adminNoticeVersion' ] );
       $uapMlmPpAdmin = new \UapMlmPp\Admin\Main();
     }
     $uapMlmPpPublic = new \UapMlmPp\Main();
   }
 }

 // MyCRED.
 if ( class_exists( '\UapMyc\Utilities' ) ){
   global $UapMycAdmin;
   if ( $UapMycAdmin === null ) {
     if ( is_admin() ){
       remove_action( 'admin_notices', [ 'UapMyc\Utilities', 'adminNotice' ] );
       remove_action( 'admin_notices', [ 'UapMyc\Utilities', 'adminNoticeVersion' ] );
       $UapMycAdmin = new \UapMyc\Admin\Main();
     }
     $UapMycPublic = new \UapMyc\Main();
   }
 }

 // Ninja Forms Tracking.
 if ( class_exists( '\UapNfT\Utilities' ) ){
   global $UapNfT;
   if ( $UapNfT === null ) {
     $pluginSettings = new \UapNfT\Settings();
     $viewObject = new \UapNfT\View();
     if ( is_admin() ){
       remove_action( 'admin_notices', [ 'UapNfT\Utilities', 'adminNotice' ] );
       remove_action( 'admin_notices', [ 'UapNfT\Utilities', 'adminNoticeVersion' ] );
       $UapNfTAdmin = new \UapNfT\Admin\Main( $pluginSettings->get(), $viewObject );
     }
     $UapNfT = new \UapNfT\Main( $pluginSettings->get(), $viewObject );
   }
 }

 // Payout Request By Affiliate.
 if ( class_exists( '\UapPrba\Utilities' ) ){
   global $UapPrba;
   if ( $UapPrba === null ) {
     if ( is_admin() ){
       remove_action( 'admin_notices', [ 'UapPrba\Utilities', 'adminNotice' ] );
       remove_action( 'admin_notices', [ 'UapPrba\Utilities', 'adminNoticeVersion' ] );
       $UapPrbaAdmin = new \UapPrba\Admin\Main();
     }
     $UapPrba = new \UapPrba\Main();
   }
 }

 // Random Affiliate ID Generated.
 if ( class_exists( '\UapRaig\Utilities' ) ){
   global $UapRaig;
   if ( $UapRaig === null ) {
     $pluginSettings = new \UapRaig\Settings();
     $viewObject = new \UapRaig\View();
     if ( is_admin() ){
       remove_action( 'admin_notices', [ 'UapRaig\Utilities', 'adminNotice' ] );
       remove_action( 'admin_notices', [ 'UapRaig\Utilities', 'adminNoticeVersion' ] );
       $UapRaigAdmin = new \UapRaig\Admin\Main( $pluginSettings->get(), $viewObject );
     }
     $UapRaig = new \UapRaig\Main( $pluginSettings->get(), $viewObject );
   }
 }

 // Remove Dummy Data.
 if ( class_exists( '\UapRdd\Utilities' ) ){
   global $UapRddAdmin;
   if ( is_admin() && $UapRddAdmin === null ){
     remove_action( 'admin_notices', [ 'UapRdd\Utilities', 'adminNotice' ] );
     remove_action( 'admin_notices', [ 'UapRdd\Utilities', 'adminNoticeVersion' ] );
     $UapRddAdmin = new \UapRdd\Admin\Main();
   }
 }

 // Split Commission.
 if ( class_exists( '\UapSC\Utilities' ) ){
   global $UapSC;
   if ( $UapSC === null ) {
     $pluginSettings = new \UapSC\Settings();
     $viewObject = new \UapSC\View();
     if ( is_admin() ){
       remove_action( 'admin_notices', [ 'UapSC\Utilities', 'adminNotice' ] );
       remove_action( 'admin_notices', [ 'UapSC\Utilities', 'adminNoticeVersion' ] );
       $UapSCAdmin = new \UapSC\Admin\Main( $pluginSettings->get(), $viewObject );
     }
     $UapSC = new \UapSC\Main( $pluginSettings->get(), $viewObject );
   }
 }

 // WooCommerce Redirect.
 if ( class_exists( '\UapWooR\Utilities' ) ){
   global $UapWooR;
   if ( $UapWooR === null ) {
     $pluginSettings = new \UapWooR\Settings();
     $viewObject = new \UapWooR\View();
     if ( is_admin() ){
       remove_action( 'admin_notices', [ 'UapWooR\Utilities', 'adminNotice' ] );
       remove_action( 'admin_notices', [ 'UapWooR\Utilities', 'adminNoticeVersion' ] );
       $UapWooRAdmin = new \UapWooR\Admin\Main( $pluginSettings->get(), $viewObject );
     }
     $UapWooR = new \UapWooR\Main( $pluginSettings->get(), $viewObject );
   }
 }

 // WooCommerce Revenue Sharing.
 if ( class_exists( '\UapWooRVS\Utilities' ) ){
   global $uapRvs;
   if ( $uapRvs === null ) {
     $pluginSettings = new \UapWooRVS\Settings();
     $viewObject = new \UapWooRVS\View();
     if ( is_admin() ){
       remove_action( 'admin_notices', [ 'UapWooRVS\Utilities', 'adminNotice' ] );
       remove_action( 'admin_notices', [ 'UapWooRVS\Utilities', 'adminNoticeVersion' ] );
       $uapRvsAdmin = new \UapWooRVS\Admin\Main( $pluginSettings->get(), $viewObject );
     }
     $uapRvs = new \UapWooRVS\Main( $pluginSettings->get(), $viewObject );
   }
 }

 // WooCommerce Product Discounts For Affiliates.
 if ( defined( 'UAP_WD_DIR' ) ){
   if ( ! class_exists( '\UapWd\Utilities' ) ) {
     include UAP_WD_DIR . 'vendor/autoload.php';
   }
   global $UapWdPublic;
   if ( $UapWdPublic === null ) {
     if ( is_admin() ){
         $UapWdAdmin = new \UapWd\Admin\Main();
     }
     $UapWdPublic = new \UapWd\Main();
   }
 }

 // WooCommerce Product Discounts For Referred Buyers.
 if ( defined( 'UAP_WDRU_DIR' ) ){
   if ( ! class_exists( '\UapWdru\Utilities' ) ) {
     include UAP_WDRU_DIR . 'vendor/autoload.php';
   }
   global $UapWdruPublic;
   if ( $UapWdruPublic === null ) {
     if ( is_admin() ){
         $UapWdruAdmin = new \UapWdru\Admin\Main();
     }
     $UapWdruPublic = new \UapWdru\Main();
   }
 }

 // WPForms Tracking.
 if ( class_exists( '\UapWpForms\Utilities' ) ){
   global $UapWpForms;
   if ( $UapWpForms === null ) {
     $pluginSettings = new \UapWpForms\Settings();
     $viewObject = new \UapWpForms\View();
     if ( is_admin() ){
       remove_action( 'admin_notices', [ 'UapWpForms\Utilities', 'adminNotice' ] );
       remove_action( 'admin_notices', [ 'UapWpForms\Utilities', 'adminNoticeVersion' ] );
       $UapWpFormsAdmin = new \UapWpForms\Admin\Main( $pluginSettings->get(), $viewObject );
     }
     $UapWpForms = new \UapWpForms\Main( $pluginSettings->get(), $viewObject );
   }
 }

 // Zapier Integration.
 if ( class_exists( '\UapZapier\Utilities' ) ){
   global $UapZapier;
   if ( $UapZapier === null ) {
     $pluginSettings = new \UapZapier\Settings();
     $viewObject = new \UapZapier\View();
     if ( is_admin() ){
       remove_action( 'admin_notices', [ 'UapZapier\Utilities', 'adminNotice' ] );
       remove_action( 'admin_notices', [ 'UapZapier\Utilities', 'adminNoticeVersion' ] );
       $UapZapierAdmin = new \UapZapier\Admin\Main( $pluginSettings->get(), $viewObject );
     }
     $UapZapier = new \UapZapier\Main( $pluginSettings->get(), $viewObject );
   }
 }

 if ( file_exists( __DIR__ . '/inc/plugin-setup.php' ) ) {
    require_once __DIR__ . '/inc/plugin-setup.php';
}
