<?php

/**
 * About setup
 *
 * @package Doctors Profile
 */

require_once trailingslashit(get_template_directory()) . 'inc/about/class.about.php';

if (!function_exists('doctors_profile_about_setup')) :

	/**
	 * About setup.
	 *
	 * @since 1.0.0
	 */
	function doctors_profile_about_setup()
	{
		$theme = wp_get_theme();
		$xtheme_name = $theme->get('Name');
		$xtheme_domain = $theme->get('TextDomain');
		if ($xtheme_domain == 'x-magazine') {
			$theme_slug = $xtheme_domain;
		} else {
			$theme_slug = 'doctors-profile';
		}



		$config = array(
			// Menu name under Appearance.
			'menu_name'               => sprintf(esc_html__('%s Info', 'doctors-profile'), $xtheme_name),
			// Page title.
			'page_name'               => sprintf(esc_html__('%s Info', 'doctors-profile'), $xtheme_name),
			/* translators: Main welcome title */
			'welcome_title'         => sprintf(esc_html__('Welcome to %s! - Version ', 'doctors-profile'), $theme['Name']),
			// Main welcome content
			// Welcome content.
			'welcome_content' => sprintf(esc_html__('%1$s is now installed and ready to use. We want to make sure you have the best experience using the theme and that is why we gathered here all the necessary information for you. Thanks for using our theme!', 'doctors-profile'), $theme['Name']),

			// Tabs.
			'tabs' => array(
				'getting_started' => esc_html__('Getting Started', 'doctors-profile'),
				'recommended_actions' => esc_html__('Recommended Actions', 'doctors-profile'),
				'useful_plugins'  => esc_html__('Useful Plugins', 'doctors-profile'),
				'free_pro'  => esc_html__('Free Vs Pro', 'doctors-profile'),
			),

			// Quick links.
			'quick_links' => array(
				'xmagazine_url' => array(
					'text'   => esc_html__('UPGRADE Doctors Profile Pro', 'doctors-profile'),
					'url'    => 'https://wpthemespace.com/product/doctors-profile-pro/?add-to-cart=7654',
					'button' => 'danger',
				),
				'update_url' => array(
					'text'   => esc_html__('View demo', 'doctors-profile'),
					'url'    => 'https://doctors.fullsitediting.com/',
					'button' => 'primery',
				),

			),

			// Getting started.
			'getting_started' => array(
				'one' => array(
					'title'       => esc_html__('Demo Content', 'doctors-profile'),
					'icon'        => 'dashicons dashicons-layout',
					'description' => sprintf(esc_html__('Demo content is pro feature. To import sample demo content, %1$s plugin should be installed and activated. After plugin is activated, visit Import Demo Data menu under Appearance.', 'doctors-profile'), esc_html__('One Click Demo Import', 'doctors-profile')),
					'button_text' => esc_html__('UPGRADE For  Demo Content', 'doctors-profile'),
					'button_url'  => 'https://wpthemespace.com/product/doctors-profile-pro/?add-to-cart=7654',
					'button_type' => 'primary',
					'is_new_tab'  => true,
				),

				'two' => array(
					'title'       => esc_html__('Theme Options', 'doctors-profile'),
					'icon'        => 'dashicons dashicons-admin-customizer',
					'description' => esc_html__('Theme uses Customizer API for theme options. Using the Customizer you can easily customize different aspects of the theme.', 'doctors-profile'),
					'button_text' => esc_html__('Customize', 'doctors-profile'),
					'button_url'  => wp_customize_url(),
					'button_type' => 'primary',
				),
				'three' => array(
					'title'       => esc_html__('Show Video', 'doctors-profile'),
					'icon'        => 'dashicons dashicons-layout',
					'description' => sprintf(esc_html__('You may show Doctors Profile short video for better understanding', 'doctors-profile'), esc_html__('One Click Demo Import', 'doctors-profile')),
					'button_text' => esc_html__('Show video', 'doctors-profile'),
					'button_url'  => 'https://www.youtube.com/watch?v=pNlm-ArOHTM&t=18s',
					'button_type' => 'primary',
					'is_new_tab'  => true,
				),
				'five' => array(
					'title'       => esc_html__('Set Widgets', 'doctors-profile'),
					'icon'        => 'dashicons dashicons-tagcloud',
					'description' => esc_html__('Set widgets in your sidebar, Offcanvas as well as footer.', 'doctors-profile'),
					'button_text' => esc_html__('Add Widgets', 'doctors-profile'),
					'button_url'  => admin_url() . '/widgets.php',
					'button_type' => 'link',
					'is_new_tab'  => true,
				),
				'six' => array(
					'title'       => esc_html__('Theme Preview', 'doctors-profile'),
					'icon'        => 'dashicons dashicons-welcome-view-site',
					'description' => esc_html__('You can check out the theme demos for reference to find out what you can achieve using the theme and how it can be customized. Theme demo only work in pro theme', 'doctors-profile'),
					'button_text' => esc_html__('View Demo', 'doctors-profile'),
					'button_url'  => 'https://doctors.fullsitediting.com/',
					'button_type' => 'link',
					'is_new_tab'  => true,
				),
				'seven' => array(
					'title'       => esc_html__('Contact Support', 'doctors-profile'),
					'icon'        => 'dashicons dashicons-sos',
					'description' => esc_html__('Got theme support question or found bug or got some feedbacks? Best place to ask your query is the dedicated Support forum for the theme.', 'doctors-profile'),
					'button_text' => esc_html__('Contact Support', 'doctors-profile'),
					'button_url'  => 'https://wpthemespace.com/support/',
					'button_type' => 'link',
					'is_new_tab'  => true,
				),
			),

			'useful_plugins'        => array(
				'description' => esc_html__('Theme supports some helpful WordPress plugins to enhance your site. But, please enable only those plugins which you need in your site. For example, enable WooCommerce only if you are using e-commerce.', 'doctors-profile'),
				'already_activated_message' => esc_html__('Already activated', 'doctors-profile'),
				'version_label' => esc_html__('Version: ', 'doctors-profile'),
				'install_label' => esc_html__('Install and Activate', 'doctors-profile'),
				'activate_label' => esc_html__('Activate', 'doctors-profile'),
				'deactivate_label' => esc_html__('Deactivate', 'doctors-profile'),
				'content'                   => array(
					array(
						'slug' => 'magical-addons-for-elementor',
						'icon' => 'svg',
					),
					array(
						'slug' => 'magical-products-display'
					),
					array(
						'slug' => 'magical-posts-display'
					),
					array(
						'slug' => 'click-to-top'
					),
					array(
						'slug' => 'gallery-box',
						'icon' => 'svg',
					),
					array(
						'slug' => 'magical-blocks'
					),
					array(
						'slug' => 'easy-share-solution',
						'icon' => 'svg',
					),
					array(
						'slug' => 'wp-edit-password-protected',
						'icon' => 'svg',
					),
				),
			),
			// Required actions array.
			'recommended_actions'        => array(
				'install_label' => esc_html__('Install and Activate', 'doctors-profile'),
				'activate_label' => esc_html__('Activate', 'doctors-profile'),
				'deactivate_label' => esc_html__('Deactivate', 'doctors-profile'),
				'content'            => array(
					'magical-blocks' => array(
						'title'       => __('Magical Addons', 'doctors-profile'),
						'description' => __('Now you can add or update your site elements very easily by Magical Products Display. Supercharge your Elementor block with highly customizable Magical Blocks For WooCommerce.', 'doctors-profile'),
						'plugin_slug' => 'magical-addons-for-elementor',
						'id' => 'magical-posts-display'
					),
					'go-pro' => array(
						'title'       => '<a target="_blank" class="activate-now button button-danger" href="https://wpthemespace.com/product/doctors-profile-pro/?add-to-cart=7654">' . __('UPGRADE Doctors Profile Pro', 'doctors-profile') . '</a>',
						'description' => __('You will get more frequent updates and quicker support with the Pro version.', 'doctors-profile'),
						//'plugin_slug' => 'x-instafeed',
						'id' => 'go-pro'
					),

				),
			),
			// Free vs pro array.
			'free_pro'                => array(
				'free_theme_name'     => $xtheme_name,
				'pro_theme_name'      => $xtheme_name . __(' Pro', 'doctors-profile'),
				'pro_theme_link'      => 'https://wpthemespace.com/product/doctors-profile-pro/',
				/* translators: View link */
				'get_pro_theme_label' => sprintf(__('Get %s', 'doctors-profile'), 'Doctors Profile Pro'),
				'features'            => array(
					array(
						'title'       => esc_html__('Daring Design for Devoted Readers', 'doctors-profile'),
						'description' => esc_html__('AgencyX\'s design helps you stand out from the crowd and create an experience that your readers will love and talk about. With a flexible home page you have the chance to easily showcase appealing content with ease.', 'doctors-profile'),
						'is_in_lite'  => 'true',
						'is_in_pro'   => 'true',
					),
					array(
						'title'       => esc_html__('Mobile-Ready For All Devices', 'doctors-profile'),
						'description' => esc_html__('Doctors Profile makes room for your readers to enjoy your articles on the go, no matter the device their using. We shaped everything to look amazing to your audience.', 'doctors-profile'),
						'is_in_lite'  => 'true',
						'is_in_pro'   => 'true',
					),
					array(
						'title'       => esc_html__('Home slider', 'doctors-profile'),
						'description' => esc_html__('Doctors Profile gives you extra slider feature. You can create awesome home slider in this theme.', 'doctors-profile'),
						'is_in_lite'  => 'true',
						'is_in_pro'   => 'true',
					),
					array(
						'title'       => esc_html__('Widgetized Sidebars To Keep Attention', 'doctors-profile'),
						'description' => esc_html__('Doctors Profile comes with a widget-based flexible system which allows you to add your favorite widgets over the Sidebar as well as on offcanvas too.', 'doctors-profile'),
						'is_in_lite'  => 'true',
						'is_in_pro'   => 'true',
					),
					array(
						'title'       => esc_html__('Auto Set-up Feature', 'doctors-profile'),
						'description' => esc_html__('You can import demo site only one click so you can setup your site like demo very easily.', 'doctors-profile'),
						'is_in_lite'  => 'ture',
						'is_in_pro'   => 'true',
					),
					array(
						'title'       => esc_html__('Multiple Header Layout', 'doctors-profile'),
						'description' => esc_html__('Doctors Profile gives you extra ways to showcase your header with miltiple layout option you can change it on the basis of your requirement', 'doctors-profile'),
						'is_in_lite'  => 'true',
						'is_in_pro'   => 'true',
					),
					array(
						'title'       => esc_html__('One Click Demo install', 'doctors-profile'),
						'description' => esc_html__('You can import demo site only one click so you can setup your site like demo very easily.', 'doctors-profile'),
						'is_in_lite'  => 'ture',
						'is_in_pro'   => 'true',
					),
					array(
						'title'       => esc_html__('Extra Drag and drop support', 'doctors-profile'),
						'is_in_lite'  => 'false',
						'is_in_pro'   => 'true',
					),
					array(
						'title'       => esc_html__('Advanced Portfolio Filter', 'doctors-profile'),
						'is_in_lite'  => 'false',
						'is_in_pro'   => 'true',
					),
					array(
						'title'       => esc_html__('Testimonial Carousel', 'doctors-profile'),
						'is_in_lite'  => 'false',
						'is_in_pro'   => 'true',
					),
					array(
						'title'       => esc_html__('Diffrent Style Blog', 'doctors-profile'),
						'is_in_lite'  => 'false',
						'is_in_pro'   => 'true',
					),
					array(
						'title'       => esc_html__('Flexible Home Page Design', 'doctors-profile'),
						'is_in_lite'  => 'false',
						'is_in_pro'   => 'true',
					),
					array(
						'title'       => esc_html__('Pro Service Section', 'doctors-profile'),
						'is_in_lite'  => 'false',
						'is_in_pro'   => 'true',
					),
					array(
						'title'       => esc_html__('Animation Home Text', 'doctors-profile'),
						'is_in_lite'  => 'false',
						'is_in_pro'   => 'true',
					),
					array(
						'title'       => esc_html__('Advance Customizer Options', 'doctors-profile'),
						'description' => esc_html__('Advance control for each element gives you different way of customization and maintained you site as you like and makes you feel different.', 'doctors-profile'),
						'is_in_lite'  => 'false',
						'is_in_pro'   => 'true',
					),
					array(
						'title'       => esc_html__('Advance Pagination', 'doctors-profile'),
						'description' => esc_html__('Multiple Option of pagination via customizer can be obtained on your site like Infinite scroll, Ajax Button On Click, Number as well as classical option are available.', 'doctors-profile'),
						'is_in_lite'  => 'ture',
						'is_in_pro'   => 'true',
					),

					array(
						'title'       => esc_html__('Premium Support and Assistance', 'doctors-profile'),
						'description' => esc_html__('We offer ongoing customer support to help you get things done in due time. This way, you save energy and time, and focus on what brings you happiness. We know our products inside-out and we can lend a hand to help you save resources of all kinds.', 'doctors-profile'),
						'is_in_lite'  => 'false',
						'is_in_pro'   => 'true',
					),
					array(
						'title'       => esc_html__('No Credit Footer Link', 'doctors-profile'),
						'description' => esc_html__('You can easily remove the Theme: Doctors Profile by Doctors Profile copyright from the footer area and make the theme yours from start to finish.', 'doctors-profile'),
						'is_in_lite'  => 'false',
						'is_in_pro'   => 'true',
					),
				),
			),

		);

		doctors_profile_About::init($config);
	}

endif;

add_action('after_setup_theme', 'doctors_profile_about_setup');


/**
 * Pro notice text
 *
 */
function doctors_profile_pnotice_output()
{

?>
	<div class="mgadin-hero">
		<div class="mge-info-content">
			<div class="mge-info-hello">
				<?php
				$current_theme = wp_get_theme();
				$current_theme_name = $current_theme->get('Name');
				$current_user = wp_get_current_user();

				$demo_link = esc_url('https://wpthemespace.com/product/doctors-profile-pro/');
				$pro_link = esc_url('https://wpthemespace.com/product/doctors-profile-pro/?add-to-cart=7654');


				esc_html_e('Hello, ', 'doctors-profile');
				echo esc_html($current_user->display_name);
				?>

				<?php esc_html_e('🩺', 'doctors-profile'); ?>
			</div>
			<div class="mge-info-desc">
				<div class="mge-main-message">
					<?php printf(esc_html__('🚀 Transform Your Medical Practice with %1$s Pro!', 'doctors-profile'), $current_theme_name); ?>
				</div>
				<div class="mge-features-list">
					<?php esc_html_e('✨ Advanced Patient Booking System | 🎨 Premium Medical Templates | ⚡ Lightning-Fast Performance | 📱 Mobile-First Design | 🔧 Unlimited Customization', 'doctors-profile'); ?>
				</div>
				<div class="mge-offer">
					<?php esc_html_e('🎯 Special Launch Offer: Get Pro for just $21 (Regular $59) - Limited Time Only!', 'doctors-profile'); ?>
				</div>
				<div class="mge-trust-indicators">
					<?php esc_html_e('✅ 1000+ Medical Professionals Trust Us | 💝 Lifetime Updates | 🛡️ 30-Day Money Back Guarantee', 'doctors-profile'); ?>
				</div>
			</div>
			<div class="mge-info-actions">
				<a href="<?php echo esc_url($pro_link); ?>" target="_blank" class="button button-primary upgrade-btn mge-upgrade-btn">
					<?php esc_html_e('🔥 Upgrade to Pro Now', 'doctors-profile'); ?>
				</a>
				<a href="<?php echo esc_url($demo_link); ?>" target="_blank" class="button button-secondary mge-demo-btn">
					<?php esc_html_e('👀 View Live Demo', 'doctors-profile'); ?>
				</a>
				<button class="button button-link btnend mge-dismiss-btn"><?php esc_html_e('Maybe Later', 'doctors-profile') ?></button>
			</div>
		</div>
	</div>
<?php
}

//Admin notice 
function doctors_profile_new_optins_texts()
{
	$hide_date = get_option('doctors_profile_info_text1');
	if (!empty($hide_date)) {
		$clickhide = round((time() - strtotime($hide_date)) / 24 / 60 / 60);
		if ($clickhide < 25) {
			return;
		}
	}

?>
	<div class="mgadin-notice notice notice-success mgadin-theme-dashboard mgadin-theme-dashboard-notice mge is-dismissible meis-dismissible">
		<?php doctors_profile_pnotice_output(); ?>
	</div>
<?php

}
add_action('admin_notices', 'doctors_profile_new_optins_texts');


function doctors_profile_new_optins_texts_init()
{
	$install_date = get_option('doctors_profile_theme_install_date');
	if (empty($install_date)) {
		update_option('doctors_profile_theme_install_date', current_time('mysql'));
	}

	if (isset($_GET['xbnotice']) && $_GET['xbnotice'] == 1) {
		update_option('doctors_profile_info_text1', current_time('mysql'));
	}
}
add_action('init', 'doctors_profile_new_optins_texts_init');

/**
 * Add Upgrade Pro link to WordPress Admin Bar
 */
function doctors_profile_add_pro_link_to_admin_bar($wp_admin_bar) {
    // Only show to administrators
    if (!current_user_can('manage_options')) {
        return;
    }

    $pro_link = esc_url('https://wpthemespace.com/product/doctors-profile-pro/?add-to-cart=7654');
    
    $wp_admin_bar->add_node(array(
        'id'    => 'doctors-profile-upgrade-pro',
        'title' => '🔥 Upgrade to Pro',
        'href'  => $pro_link,
        'meta'  => array(
            'target' => '_blank',
            'title'  => esc_attr__('Upgrade to Doctors Profile Pro - Get premium features!', 'doctors-profile'),
        ),
    ));
    
    // Add submenu items for more options
    $wp_admin_bar->add_node(array(
        'parent' => 'doctors-profile-upgrade-pro',
        'id'     => 'doctors-profile-demo',
        'title'  => '👀 View Live Demo',
        'href'   => esc_url('https://doctors.fullsitediting.com/'),
        'meta'   => array(
            'target' => '_blank',
            'title'  => esc_attr__('View Doctors Profile Pro Demo', 'doctors-profile'),
        ),
    ));
    
    $wp_admin_bar->add_node(array(
        'parent' => 'doctors-profile-upgrade-pro',
        'id'     => 'doctors-profile-features',
        'title'  => '⭐ Pro Features',
        'href'   => esc_url('https://wpthemespace.com/product/doctors-profile-pro/'),
        'meta'   => array(
            'target' => '_blank',
            'title'  => esc_attr__('See all Pro features', 'doctors-profile'),
        ),
    ));
    
    $wp_admin_bar->add_node(array(
        'parent' => 'doctors-profile-upgrade-pro',
        'id'     => 'doctors-profile-support',
        'title'  => '🛟 Get Support',
        'href'   => esc_url('https://wpthemespace.com/support/'),
        'meta'   => array(
            'target' => '_blank',
            'title'  => esc_attr__('Get theme support', 'doctors-profile'),
        ),
    ));
}
add_action('admin_bar_menu', 'doctors_profile_add_pro_link_to_admin_bar', 100);
