text_domain = 'ALPHA'; $this->set_constants(); $this->includes(); } /* * Setting the plugin constant */ public function set_constants() { if ( ! defined( 'ALPHA_VERSION' ) ) { define( 'ALPHA_VERSION', '1.0.0' ); } if ( ! defined( 'ALPHA_DOMAIN' ) ) { define( 'ALPHA_DOMAIN', 'alpha' ); } if ( ! defined( 'ALPHA_NAME' ) ) { define( 'ALPHA_NAME', 'Alpha Blocks' ); } if ( ! defined( 'ALPHADIR' ) ) { define( 'ALPHADIR', plugin_dir_path( ALPHA_PLUGIN_FILE ) ); } if ( ! defined( 'ALPHABASENAME' ) ) { define( 'ALPHABASENAME', plugin_basename( ALPHA_PLUGIN_FILE ) ); } if ( ! defined( 'ALPHAURL' ) ) { define( 'ALPHAURL', plugin_dir_url( ALPHA_PLUGIN_FILE ) ); } if ( ! defined( 'ALPHADEV' ) ) { define( 'ALPHADEV', true ); } if ( ! defined( 'ALPHA_IMAGES' ) ) { define( 'ALPHA_IMAGES', '_ALPHA_att' ); } } /* * Plugin include files */ public function includes() { include_once dirname( ALPHA_PLUGIN_FILE ) . '/includes/functions.php'; spl_autoload_register( function ( $class_name ) { if ( false !== strpos( $class_name, $this->text_domain ) ) { $classes_dir = realpath( plugin_dir_path( ALPHA_PLUGIN_FILE ) ) . DIRECTORY_SEPARATOR . 'class' . DIRECTORY_SEPARATOR; $class_file = strtolower( str_replace( $this->text_domain . '_', '', $class_name ) ) . '.php'; require_once $classes_dir . $class_file; } } ); } } endif;