<?php
/**
 * Controller For Navbar.
 *
 * @package miniorange-sms-order-notification-otp-verification/controllers/
 */

if ( ! defined( 'ABSPATH' ) ) {
	exit; // Exit if accessed directly.
}
use WCSMSOTP\Helper\MoConstants;
use WCSMSOTP\Helper\MoMessages;
use WCSMSOTP\Objects\Tabs;
use WCSMSOTP\Helper\MoUtility;

$mowc_server_uri     = isset( $_SERVER['REQUEST_URI'] ) ? esc_url_raw( wp_unslash( $_SERVER['REQUEST_URI'] ) ) : null;
$mowc_request_uri    = remove_query_arg( array( 'addon', 'form', 'subpage' ), $mowc_server_uri );
$mowc_profile_url    = add_query_arg( array( 'page' => $mowc_tab_details->tab_details[ Tabs::ACCOUNT ]->menu_slug ), $mowc_request_uri );
$mowc_help_url       = MoConstants::FAQ_URL;
$mowc_register_msg   = MoMessages::showMessage( MoMessages::REGISTER_WITH_US, array( 'url' => $mowc_profile_url ) );
$mowc_activation_msg = MoMessages::showMessage( MoMessages::ACTIVATE_PLUGIN, array( 'url' => $mowc_profile_url ) );
$mowc_active_tab     = isset( $_GET['page'] ) ? sanitize_text_field( wp_unslash( $_GET['page'] ) ) : ''; // phpcs:ignore WordPress.Security.NonceVerification.Missing, WordPress.Security.NonceVerification.Recommended -- Reading GET parameter from the URL for checking the tab name, doesn't require nonce verification.
$mowc_license_url    = add_query_arg( array( 'page' => $mowc_tab_details->tab_details[ Tabs::PRICING ]->menu_slug ), $mowc_request_uri );
$mowc_nonce          = $mowc_admin_handler->get_nonce_value();
$mowc_is_logged_in   = MoUtility::micr();
$mowc_is_free_plugin = strcmp( MOV_WC_TYPE, 'MiniOrangeGateway' ) === 0;

$mowc_navbar_view_file = MOV_WC_DIR . 'views/navbar.php';
if ( ! MoUtility::mo_require_file( $mowc_navbar_view_file, MOV_WC_DIR ) ) {
	return;
}
require $mowc_navbar_view_file;
