<?php
/**
 * Bloglex Constants Class.
 *
 * @package BlogLex
 */

if ( ! defined( 'ABSPATH' ) ) {
	exit;
}

if ( ! class_exists( 'Bloglex_Constants' ) ) {

	/**
	 * Bloglex_Constants class.
	 */
	class Bloglex_Constants {

		/**
		 * The single instance of the class.
		 *
		 * @var Bloglex_Constants
		 */
		private static $instance = null;

		/**
		 * Constants array.
		 *
		 * @var array
		 */
		private $constants = array();

		/**
		 * Constructor.
		 */
		private function __construct() {

			// Define constants here.
			$this->constants = array(
				/**
				 * Define URL Location Constants
				 */
				'BLOGLEX_PARENT_URL' => get_template_directory_uri(),
			);

			foreach ( $this->constants as $name => $value ) {
				$this->define_constant( $name, $value );
			}
		}

		/**
		 * Gets the single instance of the class.
		 *
		 * @return Bloglex_Constants
		 */
		public static function get_instance() {
			if ( null === self::$instance ) {
				self::$instance = new self();
			}
			return self::$instance;
		}

		/**
		 * Define constant safely.
		 *
		 * @param string $name Constant name.
		 * @param mixed $value Constant value.
		 *
		 * @return void
		 */
		private function define_constant( $name, $value ) {
			if ( ! defined( $name ) ) {
				define( $name, $value );
			}
		}
	}
}

// Initialize the class instance.
Bloglex_Constants::get_instance();
