<?php

/**
 * About setup
 *
 * @package xblog
 */

if (!function_exists('colorful_blog_about_setup')) :

	/**
	 * About setup.
	 *
	 * @since 1.0.0
	 */
	function colorful_blog_about_setup()
	{
		$theme = wp_get_theme();
		$xtheme_name = $theme->get('Name');
		$theme_slug = 'colorful-blog';



		$config = array(
			// Menu name under Appearance.
			'menu_name'               => sprintf(esc_html__('%s Info', 'colorful-blog'), $xtheme_name),
			// Page title.
			'page_name'               => sprintf(esc_html__('%s Info', 'colorful-blog'), $xtheme_name),
			/* translators: Main welcome title */
			'welcome_title'         => sprintf(esc_html__('Welcome to %s! - Version ', 'colorful-blog'), $theme['Name']),
			// Main welcome content
			// Welcome content.
			'welcome_content' => sprintf(esc_html__('You are now using the %1$s free version on your website. Transform your website and take it to the next level with Colorful Blog Pro! ', 'colorful-blog'), $theme['Name']),

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

			// Quick links.
			'quick_links' => array(
				'update_url' => array(
					'text'   => esc_html__('UPGRADE COLORFUL BLOG PRO', 'colorful-blog'),
					'url'    => 'https://wpthemespace.com/product/colorful-blog-pro/?add-to-cart=8399',
					'button' => 'danger',
				),
				'xmagazine_url' => array(
					'text'   => esc_html__('VIEW DEMO', 'colorful-blog'),
					'url'    => 'https://blog.fullsitediting.com/color/demos',
					'button' => 'danger',
				),


			),

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

				'two' => array(
					'title'       => esc_html__('Theme Options', 'colorful-blog'),
					'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.', 'colorful-blog'),
					'button_text' => esc_html__('Customize', 'colorful-blog'),
					'button_url'  => wp_customize_url(),
					'button_type' => 'primary',
				),
				'three' => array(
					'title'       => esc_html__('Show Video', 'colorful-blog'),
					'icon'        => 'dashicons dashicons-layout',
					'description' => sprintf(esc_html__('You may show Xblog short video for better understanding', 'colorful-blog'), esc_html__('One Click Demo Import', 'colorful-blog')),
					'button_text' => esc_html__('Show video', 'colorful-blog'),
					'button_url'  => 'https://www.youtube.com/watch?v=Cu3eFFQskCs',
					'button_type' => 'primary',
					'is_new_tab'  => true,
				),
				'four' => array(
					'title'       => esc_html__('Theme Documentation', 'colorful-blog'),
					'icon'        => 'dashicons dashicons-format-aside',
					'description' => esc_html__('Please check our full documentation for detailed information on how to setup and customize the theme.', 'colorful-blog'),
					'button_text' => esc_html__('View Documentation', 'colorful-blog'),
					'button_url'  => 'http://wpthemespace.com/xblog/doc/',
					'button_type' => 'primary',
					'is_new_tab'  => true,
				),
				'five' => array(
					'title'       => esc_html__('Set Widgets', 'colorful-blog'),
					'icon'        => 'dashicons dashicons-tagcloud',
					'description' => esc_html__('Set widgets in your sidebar, Offcanvas as well as footer.', 'colorful-blog'),
					'button_text' => esc_html__('Add Widgets', 'colorful-blog'),
					'button_url'  => admin_url() . '/widgets.php',
					'button_type' => 'link',
					'is_new_tab'  => true,
				),
				'six' => array(
					'title'       => esc_html__('Theme Preview', 'colorful-blog'),
					'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', 'colorful-blog'),
					'button_text' => esc_html__('View Demo', 'colorful-blog'),
					'button_url'  => 'https://wpthemespace.com/product/colorful-blog',
					'button_type' => 'link',
					'is_new_tab'  => true,
				),
				'seven' => array(
					'title'       => esc_html__('Contact Support', 'colorful-blog'),
					'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.', 'colorful-blog'),
					'button_text' => esc_html__('Contact Support', 'colorful-blog'),
					'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.', 'colorful-blog'),
				'already_activated_message' => esc_html__('Already activated', 'colorful-blog'),
				'version_label' => esc_html__('Version: ', 'colorful-blog'),
				'install_label' => esc_html__('Install and Activate', 'colorful-blog'),
				'activate_label' => esc_html__('Activate', 'colorful-blog'),
				'deactivate_label' => esc_html__('Deactivate', 'colorful-blog'),
				'content'                   => array(
					array(
						'slug' => 'magical-addons-for-elementor',
						'icon' => 'svg',
					),
					array(
						'slug' => 'magical-products-display',
						'icon' => 'svg',
					),
					array(
						'slug' => 'magical-blocks'
					),
					array(
						'slug' => 'magical-posts-display'
					),
					array(
						'slug' => 'click-to-top'
					),
					array(
						'slug' => 'gallery-box',
						'icon' => 'svg',
					),
					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', 'colorful-blog'),
				'activate_label' => esc_html__('Activate', 'colorful-blog'),
				'deactivate_label' => esc_html__('Deactivate', 'colorful-blog'),
				'content'            => array(
					'magical-blocks' => array(
						'title'       => __('Magical Posts Display', 'colorful-blog'),
						'description' => __('The best part of Magical Addons is that you can design anything without having to touch a single line of code. Magical Addons has a huge collection of premium and highly functional extensions that can be used in an Elementor page builder. This is really a premium plugin that you can get for free.', 'colorful-blog'),
						'plugin_slug' => 'magical-addons-for-elementor',
						'id' => 'magical-addons-for-elementor'
					),
					'go-pro' => array(
						'title'       => '<a target="_blank" class="activate-now button button-danger" href="https://wpthemespace.com/product/colorful-blog-pro/?add-to-cart=8399">' . __('UPGRADE COLORFUL BLOG', 'colorful-blog') . '</a>',
						'description' => __('You will get more frequent updates and quicker support with the Pro version.', 'colorful-blog'),
						'id' => 'go-pro'
					),

				),
			),
			// Free vs pro array.
			'free_pro'                => array(
				'free_theme_name'     => $xtheme_name,
				'pro_theme_name'      => $xtheme_name . __(' Pro', 'colorful-blog'),
				'pro_theme_link'      => 'https://wpthemespace.com/product/colorful-blog-pro/?add-to-cart=8399',
				/* translators: View link */
				'get_pro_theme_label' => sprintf(__('Get %s', 'colorful-blog'), 'colorful-blog'),
				'features'            => array(
					array(
						'title'       => esc_html__('Daring Design for Devoted Readers', 'colorful-blog'),
						'description' => esc_html__('Colorful Blog\'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.', 'colorful-blog'),
						'is_in_lite'  => 'true',
						'is_in_pro'   => 'true',
					),
					array(
						'title'       => esc_html__('Mobile-Ready For All Devices', 'colorful-blog'),
						'description' => esc_html__('Colorful Blog 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.', 'colorful-blog'),
						'is_in_lite'  => 'true',
						'is_in_pro'   => 'true',
					),
					array(
						'title'       => esc_html__('Home slider', 'colorful-blog'),
						'description' => esc_html__('Colorful Blog gives you extra slider feature. You can create awesome home slider in this theme.', 'colorful-blog'),
						'is_in_lite'  => 'true',
						'is_in_pro'   => 'true',
					),
					array(
						'title'       => esc_html__('Widgetized Sidebars To Keep Attention', 'colorful-blog'),
						'description' => esc_html__('Colorful Blog comes with a widget-based flexible system which allows you to add your favorite widgets over the Sidebar as well as on offcanvas too.', 'colorful-blog'),
						'is_in_lite'  => 'true',
						'is_in_pro'   => 'true',
					),
					array(
						'title'       => esc_html__('Multiple Header Layout', 'colorful-blog'),
						'description' => esc_html__('Colorful Blog gives you extra ways to showcase your header with miltiple layout option you can change it on the basis of your requirement', 'colorful-blog'),
						'is_in_lite'  => 'true',
						'is_in_pro'   => 'true',
					),
					array(
						'title'       => esc_html__('Banner Slider Options', 'colorful-blog'),
						'description' => esc_html__('Colorful Blog\'s PRO version comes with more Slider options to display and filter posts. For instance, you can have far more control on setting the source of the posts or how they are displayed, everything to push the content to the right people and promote it by the blink of an eye.', 'colorful-blog'),
						'is_in_lite'  => 'false',
						'is_in_pro'   => 'true',
					),
					array(
						'title'       => esc_html__('Flexible Home Page Design', 'colorful-blog'),
						'description' => esc_html__('Colorful Blog\'s PRO version has more controll available to enable you to place widgets on Footer or Below the Post at the end of your articles.', 'colorful-blog'),
						'is_in_lite'  => 'false',
						'is_in_pro'   => 'true',
					),
					array(
						'title'       => esc_html__('Read Time Calculator and total words counter', 'colorful-blog'),
						'description' => esc_html__('Minimal Lit\'s PRO verison has a feature to let your viewer know the read time of the standared article you have posted on the basis of words per minute which you can control on your customizer .', 'colorful-blog'),
						'is_in_lite'  => 'false',
						'is_in_pro'   => 'true',
					),
					array(
						'title'       => esc_html__('Advance Customizer Options', 'colorful-blog'),
						'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.', 'colorful-blog'),
						'is_in_lite'  => 'false',
						'is_in_pro'   => 'true',
					),
					array(
						'title'       => esc_html__('Advance Pagination', 'colorful-blog'),
						'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.', 'colorful-blog'),
						'is_in_lite'  => 'ture',
						'is_in_pro'   => 'true',
					),
					array(
						'title'       => esc_html__('One Click Demo install', 'colorful-blog'),
						'description' => esc_html__('You can import demo site only one click so you can setup your site like demo very easily.', 'colorful-blog'),
						'is_in_lite'  => 'ture',
						'is_in_pro'   => 'true',
					),
					array(
						'title'       => esc_html__('Premium Support and Assistance', 'colorful-blog'),
						'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.', 'colorful-blog'),
						'is_in_lite'  => 'false',
						'is_in_pro'   => 'true',
					),
					array(
						'title'       => esc_html__('No Credit Footer Link', 'colorful-blog'),
						'description' => esc_html__('You can easily remove the Theme: Colorful Blog by xblog copyright from the footer area and make the theme yours from start to finish.', 'colorful-blog'),
						'is_in_lite'  => 'false',
						'is_in_pro'   => 'true',
					),
				),
			),

		);

		colorful_blog_About::init($config);
	}

endif;

add_action('after_setup_theme', 'colorful_blog_about_setup');


/**
 * Pro notice text
 *
 */
function colorful_blog_pnotice_output()
{
	$current_theme = wp_get_theme();
	$current_theme_name = $current_theme->get('Name');
	$current_user = wp_get_current_user();
	$pro_link = 'https://wpthemespace.com/product/colorful-blog-pro/?add-to-cart=10637';
	$demo_link = 'https://wpthemespace.com/product/colorful-blog-pro/';
?>


	<div class="colorful-blog-promo">
		<div class="colorful-blog-header">
			<div class="colorful-blog-icon">
				🎨
			</div>
			<div>
				<h3 class="colorful-blog-title"><?php printf(esc_html__('Unlock %s Pro!', 'colorful-blog'), esc_html($current_theme_name)); ?></h3>
				<p class="colorful-blog-greeting"><?php printf(esc_html__('Hey %s! 👋', 'colorful-blog'), esc_html($current_user->display_name)); ?></p>
			</div>
		</div>

		<p class="colorful-blog-description">
			<?php 
				/* translators: %s: "Pro features" text with emphasis */
				printf(
					esc_html__('Transform your blog with %s: unlimited colors, advanced SEO, lightning speed & stunning animations!', 'colorful-blog'),
					'<strong>' . esc_html__('Pro features', 'colorful-blog') . '</strong>'
				);
			?>
		</p>

		<div class="colorful-blog-features">
			<div class="colorful-blog-feature">
				<div class="colorful-blog-checkmark">✓</div>
				<span><?php esc_html_e('More Security', 'colorful-blog'); ?></span>
			</div>
			<div class="colorful-blog-feature">
				<div class="colorful-blog-checkmark">✓</div>
				<span><?php esc_html_e('No Footer Credit', 'colorful-blog'); ?></span>
			</div>
			<div class="colorful-blog-feature">
				<div class="colorful-blog-checkmark">✓</div>
				<span><?php esc_html_e('Easy to load', 'colorful-blog'); ?></span>
			</div>
			<div class="colorful-blog-feature">
				<div class="colorful-blog-checkmark">✓</div>
				<span><?php esc_html_e('Unlimited Options', 'colorful-blog'); ?></span>
			</div>
		</div>

		<div class="colorful-blog-actions">
			<a href="<?php echo esc_url($pro_link); ?>" target="_blank" class="colorful-blog-btn colorful-blog-btn-primary">
				🚀 <?php esc_html_e('Upgrade Now', 'colorful-blog'); ?>
			</a>
			<a href="<?php echo esc_url($demo_link); ?>" target="_blank" class="colorful-blog-btn colorful-blog-btn-secondary">
				👀 <?php esc_html_e('View Demo', 'colorful-blog'); ?>
			</a>
			<button class="colorful-blog-btn colorful-blog-btn-dismiss btnend">
				 <?php esc_html_e('May Be Later', 'colorful-blog'); ?>
			</button>
		</div>
	</div>
<?php
}


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

	/* $install_date = get_option('colorful_blog_theme_install_date');
	if (!empty($install_date)) {
		$install_day = round((time() - strtotime($install_date)) / 24 / 60 / 60);
		if ($install_day < 1) {
			return;
		}
	} */

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

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

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

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