define( 'AIPV', true ); $this->define( 'AIPV_FILE', __FILE__ ); $this->define( 'AIPV_DIRNAME', dirname( __FILE__ ) ); $this->define( 'AIPV_PLUGIN_DIR', plugin_dir_url( __FILE__ ) ); $this->define( 'AIPV_BASENAME', basename( dirname( __FILE__ ) ) ); // Do all the plugin stuff. $this->plugin = new AIPV_Plugin(); // Generate posts with appropriate metadata $this->posts = new AIPV_Posts(); // Ai Image processing $this->ai_processor = new AIPV_AI_Processor(); } /** * __call * * Sugar function to access class properties * * @param string $name The property name. * @return void */ public function __call( $name, $arguments ) { return $this->{$name}; } /** * define * * Defines a constant if doesnt already exist. * * @param string $name The constant name. * @param mixed $value The constant value. * @return void */ function define( $name, $value = true ) { if ( ! defined( $name ) ) { define( $name, $value ); } } } /* * aipv * * The main function responsible for returning the one true AIPostVisualizer Instance to functions everywhere. * Use this function like you would a global variable, except without needing to declare the global. * * @param void * @return AIPostVisualizer */ function aipv() { global $aipv; // Instantiate only once. if ( ! isset( $aipv ) ) { $aipv = new AIPostVisualizer (); $aipv->initialize(); } return $aipv; } // Instantiate. aipv(); } // class_exists check