<?php
/**
 *
 * @package somalite
 */

define('SOMALITE_THEME_URL','https://www.spiraclethemes.com/soma-free-wordpress-theme/');
define('SOMALITE_THEME_PRO_URL','https://www.spiraclethemes.com/soma-pro-addons/');
define('SOMALITE_THEME_DOC_URL','https://www.spiraclethemes.com/soma-documentation/');
define('SOMALITE_THEME_VIDEOS_URL','https://www.spiraclethemes.com/soma-video-tutorials/');
define('SOMALITE_THEME_SUPPORT_URL','https://wordpress.org/support/theme/somalite/');
define('SOMALITE_THEME_RATINGS_URL','https://wordpress.org/support/theme/somalite/reviews/#new-post');
define('SOMALITE_THEME_CHANGELOGS_URL','https://themes.trac.wordpress.org/log/somalite/');
define('SOMALITE_THEME_CONTACT_URL','https://www.spiraclethemes.com/contact/');


if ( ! class_exists( 'Somalite_About_Page' ) ) {
	/**
	 * Singleton class used for generating the about page of the theme.
	 */
	class Somalite_About_Page {
		/**
		 * Define the version of the class.
		 *
		 * @var string $version The Somalite_About_Page class version.
		 */
		private $version = '1.0.0';
		/**
		 * Used for loading the texts and setup the actions inside the page.
		 *
		 * @var array $config The configuration array for the theme used.
		 */
		private $config;
		/**
		 * Get the theme name using wp_get_theme.
		 *
		 * @var string $theme_name The theme name.
		 */
		private $theme_name;
		/**
		 * Get the theme slug ( theme folder name ).
		 *
		 * @var string $theme_slug The theme slug.
		 */
		private $theme_slug;
		/**
		 * The current theme object.
		 *
		 * @var WP_Theme $theme The current theme.
		 */
		private $theme;
		/**
		 * Holds the theme version.
		 *
		 * @var string $theme_version The theme version.
		 */
		private $theme_version;		
		/**
		 * Define the html notification content displayed upon activation.
		 *
		 * @var string $notification The html notification content.
		 */
		private $notification;
		/**
		 * The single instance of Somalite_About_Page
		 *
		 * @var Somalite_About_Page $instance The Somalite_About_Page instance.
		 */
		private static $instance;
		/**
		 * The Main Somalite_About_Page instance.
		 *
		 * We make sure that only one instance of Somalite_About_Page exists in the memory at one time.
		 *
		 * @param array $config The configuration array.
		 */
		public static function init( $config ) {
			if ( ! isset( self::$instance ) && ! ( self::$instance instanceof Somalite_About_Page ) ) {
				self::$instance = new Somalite_About_Page;				
				self::$instance->config = $config;
				self::$instance->somalite_setup_config();
			}
		}

		/**
		 * Setup the class props based on the config array.
		 */
		public function somalite_setup_config() {
			$theme = wp_get_theme();
			if ( is_child_theme() ) {
				$this->theme_name = $theme->parent()->get( 'Name' );
				$this->theme      = $theme->parent();
			} else {
				$this->theme_name = $theme->get( 'Name' );
				$this->theme      = $theme->parent();
			}
			$this->theme_version = $theme->get( 'Version' );
			$this->theme_slug    = $theme->get_template();		
		}	

	}
}


/**
 *  Adding a About Soma page 
 */
add_action('admin_menu', 'somalite_add_menu');

function somalite_add_menu() {
     add_theme_page(esc_html__('About Soma Theme','somalite'), esc_html__('About Soma','somalite'),'manage_options', esc_html__('somalite-theme-info','somalite'), esc_html__('somalite_theme_info','somalite'));
}

/**
 *  Callback
 */
function somalite_theme_info() {
?>
	<div class="soma-info">
		<div class="container">
			<div class="row">
				<div class="col-md-12">
					<div class="title">
						<h2><?php esc_html_e( 'Thank you for using Soma Lite free WordPress theme', 'somalite' ); ?></h2>
						<div class="title-content">
							<p><?php esc_html_e( 'Soma is an incredibly beautiful and fully responsive Bootstrap WordPress Theme. A perfect solution for businesses, creatives & online shops. Build whatever you like with this theme. Suitable for Business, Corporate, Portfolio, Agency, Real estate, Medical, Events, Construction, Restaurant, Blog, Landing pages, Charity Nonprofit, Ecommerce websites etc.', 'somalite' ); ?></p>
						</div>
					</div>
				</div>
			</div>

			<div class="row">
				<div class="col-md-3">
					<div class="section-box">
						<div class="icon">
							<span class="dashicons dashicons-visibility"></span>
						</div>
						<div class="heading">
							<h3><a href="<?php echo esc_url(SOMALITE_THEME_URL); ?>" target="_blank"><?php esc_html_e( 'VIEW DEMO', 'somalite' ); ?></a></h3>
						</div>						
					</div>
				</div>
				<div class="col-md-3">
					<div class="section-box">
						<div class="icon">
							<span class="dashicons dashicons-format-aside"></span>
						</div>
						<div class="heading">
							<h3><a href="<?php echo esc_url(SOMALITE_THEME_DOC_URL); ?>" target="_blank"><?php esc_html_e( 'VIEW DOCUMENTATION', 'somalite' ); ?></a></h3>
						</div>						
					</div>
				</div>
				<div class="col-md-3">
					<div class="section-box">
						<div class="icon">
							<span class="dashicons dashicons-video-alt2"></span>
						</div>
						<div class="heading">
							<h3><a href="<?php echo esc_url(SOMALITE_THEME_VIDEOS_URL); ?>" target="_blank"><?php esc_html_e( 'VIDEO TUTORIALS', 'somalite' ); ?></a></h3>
						</div>						
					</div>
				</div>
				<div class="col-md-3">
					<div class="section-box">
						<div class="icon">
							<span class="dashicons dashicons-sos"></span>
						</div>
						<div class="heading">
							<h3><a href="<?php echo esc_url(SOMALITE_THEME_SUPPORT_URL); ?>" target="_blank"><?php esc_html_e( 'ASK FOR SUPPORT', 'somalite' ); ?></a></h3>
						</div>						
					</div>
				</div>
			</div>

			<div class="row">
				<div class="col-md-3">
					<div class="section-box">
						<div class="icon">
							<span class="dashicons dashicons-star-filled"></span>
						</div>
						<div class="heading">
							<h3><a href="<?php echo esc_url(SOMALITE_THEME_RATINGS_URL); ?>" target="_blank"><?php esc_html_e( 'RATE OUR THEME', 'somalite' ); ?></a></h3>
						</div>						
					</div>
				</div>
				<div class="col-md-3">
					<div class="section-box">
						<div class="icon">
							<span class="dashicons dashicons-admin-tools"></span>
						</div>
						<div class="heading">
							<h3><a href="<?php echo esc_url(SOMALITE_THEME_CHANGELOGS_URL); ?>" target="_blank"><?php esc_html_e( 'VIEW CHANGELOGS', 'somalite' ); ?></a></h3>
						</div>						
					</div>
				</div>
				<div class="col-md-3">
					<div class="section-box">
						<div class="icon">
							<span class="dashicons dashicons-email-alt"></span>
						</div>
						<div class="heading">
							<h3><a href="<?php echo esc_url(SOMALITE_THEME_CONTACT_URL); ?>" target="_blank"><?php esc_html_e( 'CONTACT US', 'somalite' ); ?></a></h3>
						</div>						
					</div>
				</div>
				<div class="col-md-3">
					<div class="section-box section-last">
						<div class="icon">
							<span class="dashicons dashicons-cart"></span>
						</div>
						<div class="heading">
							<h3><a href="<?php echo esc_url(SOMALITE_THEME_PRO_URL); ?>" target="_blank"><?php esc_html_e( 'UPGRADE TO PRO FOR EXTRA FEATURES', 'somalite' ); ?></a></h3>
						</div>						
					</div>
				</div>
			</div>
		</div>		
	</div>
<?php
}
