<?php

/**
 * About setup
 *
 * @package News Axis
 */

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

if (!function_exists('news_axis_about_setup')) :

	/**
	 * About setup.
	 *
	 * @since 1.0.0
	 */
	function news_axis_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 = 'news-axis';
		}



		$config = array(
			// Menu name under Appearance.
			'menu_name'               => sprintf(esc_html__('%s Info', 'news-axis'), $xtheme_name),
			// Page title.
			'page_name'               => sprintf(esc_html__('%s Info', 'news-axis'), $xtheme_name),
			/* translators: Main welcome title */
			'welcome_title'         => sprintf(esc_html__('Welcome to %s! - Version ', 'news-axis'), $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!', 'news-axis'), $theme['Name']),

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

			// Quick links.
			'quick_links' => array(
				'xmagazine_url' => array(
					'text'   => esc_html__('UPGRADE NEWS AXIS', 'news-axis'),
					'url'    => 'https://wpthemespace.com/product/news-axis-pro/?add-to-cart=12679',
					'button' => 'danger',
				),
				'update_url' => array(
					'text'   => esc_html__('View demo', 'news-axis'),
					'url'    => 'https://articleaxis.fullsitediting.com/',
					'button' => 'primery',
				),
				'video_url' => array(
					'text'   => esc_html__('Show Video', 'news-axis'),
					'url'    => 'https://www.youtube.com/watch?v=ATu84uap_bc',
					'button' => 'danger',
				),

			),

			// Getting started.
			'getting_started' => array(
				'one' => array(
					'title'       => esc_html__('Demo Content', 'news-axis'),
					'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.', 'news-axis'), esc_html__('One Click Demo Import', 'news-axis')),
					'button_text' => esc_html__('UPGRADE For  Demo Content', 'news-axis'),
					'button_url'  => 'https://wpthemespace.com/product/news-axis-pro/?add-to-cart=12679',
					'button_type' => 'primary',
					'is_new_tab'  => true,
				),

				'two' => array(
					'title'       => esc_html__('Theme Options', 'news-axis'),
					'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.', 'news-axis'),
					'button_text' => esc_html__('Customize', 'news-axis'),
					'button_url'  => wp_customize_url(),
					'button_type' => 'primary',
				),
				'three' => array(
					'title'       => esc_html__('Show Video', 'news-axis'),
					'icon'        => 'dashicons dashicons-layout',
					'description' => sprintf(esc_html__('You may show News Axis short video for better understanding', 'news-axis'), esc_html__('One Click Demo Import', 'news-axis')),
					'button_text' => esc_html__('Show video', 'news-axis'),
					'button_url'  => 'https://www.youtube.com/watch?v=ATu84uap_bc',
					'button_type' => 'primary',
					'is_new_tab'  => true,
				),
				'five' => array(
					'title'       => esc_html__('Set Widgets', 'news-axis'),
					'icon'        => 'dashicons dashicons-tagcloud',
					'description' => esc_html__('Set widgets in your sidebar, Offcanvas as well as footer.', 'news-axis'),
					'button_text' => esc_html__('Add Widgets', 'news-axis'),
					'button_url'  => admin_url() . '/widgets.php',
					'button_type' => 'link',
					'is_new_tab'  => true,
				),
				'six' => array(
					'title'       => esc_html__('Theme Preview', 'news-axis'),
					'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', 'news-axis'),
					'button_text' => esc_html__('View Demo', 'news-axis'),
					'button_url'  => 'https://articleaxis.fullsitediting.com/',
					'button_type' => 'link',
					'is_new_tab'  => true,
				),
				'seven' => array(
					'title'       => esc_html__('Contact Support', 'news-axis'),
					'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.', 'news-axis'),
					'button_text' => esc_html__('Contact Support', 'news-axis'),
					'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.', 'news-axis'),
				'already_activated_message' => esc_html__('Already activated', 'news-axis'),
				'version_label' => esc_html__('Version: ', 'news-axis'),
				'install_label' => esc_html__('Install and Activate', 'news-axis'),
				'activate_label' => esc_html__('Activate', 'news-axis'),
				'deactivate_label' => esc_html__('Deactivate', 'news-axis'),
				'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', 'news-axis'),
				'activate_label' => esc_html__('Activate', 'news-axis'),
				'deactivate_label' => esc_html__('Deactivate', 'news-axis'),
				'content'            => array(
					'magical-blocks' => array(
						'title'       => __('Magical Posts Display', 'news-axis'),
						'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.', 'news-axis'),
						'plugin_slug' => 'magical-products-display',
						'id' => 'magical-posts-display'
					),
					'go-pro' => array(
						'title'       => '<a target="_blank" class="activate-now button button-danger" href="https://wpthemespace.com/product/news-axis-pro/?add-to-cart=12679">' . __('UPGRADE NEWS AXIS', 'news-axis') . '</a>',
						'description' => __('You will get more frequent updates and quicker support with the Pro version.', 'news-axis'),
						//'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', 'news-axis'),
				'pro_theme_link'      => 'https://articleaxis.fullsitediting.com/',
				/* translators: View link */
				'get_pro_theme_label' => sprintf(__('Get %s', 'news-axis'), 'News Axis Pro'),
				'features'            => array(
					array(
						'title'       => esc_html__('Daring Design for Devoted Readers', 'news-axis'),
						'description' => esc_html__('News Axis \'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.', 'news-axis'),
						'is_in_lite'  => 'true',
						'is_in_pro'   => 'true',
					),
					array(
						'title'       => esc_html__('Mobile Responsive', 'news-axis'),
						'description' => esc_html__('News Axis is fully responsive and can adapt to any device. Your website will look amazing on any device, whether it\'s a desktop, laptop, tablet, or smartphone.', 'news-axis'),
						'is_in_lite'  => 'true',
						'is_in_pro'   => 'true',
					),
					array(
						'title'       => esc_html__('Super Easy to Set Up', 'news-axis'),
						'description' => esc_html__('The theme is super easy to set up and you can start building your site right away. No coding skills required.', 'news-axis'),
						'is_in_lite'  => 'true',
						'is_in_pro'   => 'true',
					),
					array(
						'title'       => esc_html__('Live Customizer', 'news-axis'),
						'description' => esc_html__('News Axis makes use of the Customizer for all theme options. Customize your site in real-time with the live preview.', 'news-axis'),
						'is_in_lite'  => 'true',
						'is_in_pro'   => 'true',
					),
					array(
						'title'       => esc_html__('One Click Demo Import', 'news-axis'),
						'description' => esc_html__('Import demo content with a single click. Get your site up and running in no time.', 'news-axis'),
						'is_in_lite'  => 'false',
						'is_in_pro'   => 'true',
					),
					array(
						'title'       => esc_html__('Multiple Header Layouts', 'news-axis'),
						'description' => esc_html__('Choose from multiple header layouts to give your site a unique look.', 'news-axis'),
						'is_in_lite'  => 'false',
						'is_in_pro'   => 'true',
					),
					array(
						'title'       => esc_html__('Multiple Blog Layouts', 'news-axis'),
						'description' => esc_html__('Choose from multiple blog layouts to showcase your content in the best way.', 'news-axis'),
						'is_in_lite'  => 'false',
						'is_in_pro'   => 'true',
					),
					array(
						'title'       => esc_html__('Elementor Widgets', 'news-axis'),
						'description' => esc_html__('Access to premium Elementor widgets to enhance your site building experience.', 'news-axis'),
						'is_in_lite'  => 'false',
						'is_in_pro'   => 'true',
					),
					array(
						'title'       => esc_html__('Advance Pagination', 'news-axis'),
						'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.', 'news-axis'),
						'is_in_lite'  => 'ture',
						'is_in_pro'   => 'true',
					),

					array(
						'title'       => esc_html__('Premium Support and Assistance', 'news-axis'),
						'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.', 'news-axis'),
						'is_in_lite'  => 'false',
						'is_in_pro'   => 'true',
					),
					array(
						'title'       => esc_html__('No Credit Footer Link', 'news-axis'),
						'description' => esc_html__('You can easily remove the Theme: News Axis by News Axis copyright from the footer area and make the theme yours from start to finish.', 'news-axis'),
						'is_in_lite'  => 'false',
						'is_in_pro'   => 'true',
					),
				),
			),

		);

		news_axis_About::init($config);
	}

endif;

add_action('after_setup_theme', 'news_axis_about_setup');

/**
 * Enqueue admin styles for the notice
 */
function news_axis_admin_notice_styles($hook) {
	// Only load on admin pages
	wp_enqueue_style(
		'news-axis-admin-notice',
		get_template_directory_uri() . '/inc/about/css/about.css',
		array(),
		'1.0.0'
	);
	
	// Enqueue notice JavaScript
	wp_enqueue_script(
		'news-axis-admin-notice-js',
		get_template_directory_uri() . '/inc/about/js/notice.js',
		array('jquery'),
		'1.0.0',
		true
	);
}
add_action('admin_enqueue_scripts', 'news_axis_admin_notice_styles');

/**
 * Pro notice text
 *
 */
function news_axis_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/news-axis-pro/');
				$pro_link = esc_url('https://wpthemespace.com/product/news-axis-pro/?add-to-cart=12679');


				esc_html_e('Hi Buddy!, ', 'news-axis');
				//echo esc_html($current_user->display_name);
				?>

				<?php esc_html_e('👋🏻', 'news-axis'); ?>
			</div>
			<div class="mge-info-desc">
				<div><?php printf(esc_html__('You\'re using the free News Axis Theme, but the Pro version offers so much more! Unlock SEO-friendly features, blazing-fast speed optimization, and enhanced security. Gain access to premium Elementor widgets and ready-made demo content, all with simple one-click imports. Don\'t wait—upgrade to News Axis Pro today and take your website to the next level!', 'news-axis'), esc_html($current_theme_name)); ?></div>
				<div class="mge-offer"><?php printf(esc_html__('Don\'t miss out on these incredible features - upgrade to News Axis Pro now! only $21 Lifetime !! ', 'news-axis'), esc_html($current_theme_name)); ?></div>
			</div>
			<div class="mge-info-actions">
				<a href="<?php echo esc_url($pro_link); ?>" target="_blank" class="button button-primary upgrade-btn">
					<?php esc_html_e('Upgrade Pro', 'news-axis'); ?>
				</a>
				<a href="<?php echo esc_url($demo_link); ?>" target="_blank" class="button button-primary upgrade-btn">
					<?php esc_html_e('View Details', 'news-axis'); ?>
				</a>

				<button class="button button-info btnend"><?php esc_html_e('No Need Pro', 'news-axis') ?></button>
			</div>

		</div>

	</div>
<?php
}
//Admin notice 
function news_axis_new_optins_texts()
{

	$hide_date = get_option('news_axis_info_text2');
	if (!empty($hide_date)) {
		$clickhide = round((time() - strtotime($hide_date)) / 24 / 60 / 60);
		if ($clickhide < 25) {
			return;
		}
	}
?>
	<div class="mgadin-notice notice notice-info mgadin-theme-dashboard mgadin-theme-dashboard-notice mge is-dismissible meis-dismissible">
		<?php news_axis_pnotice_output(); ?>
	</div>
<?php

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

function news_axis_new_optins_texts_init()
{
	$news_axis_install_date = get_option('news_axis_install_date');
	if (empty($news_axis_install_date)) {
		update_option('news_axis_install_date', current_time('mysql'));
	}

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