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();