opt = array_merge( $old_opt, $new_opt ); $this->define_constants(); $this->includes(); $this->init_hooks(); } /** * Gets the instance of this class. * * @return self */ public static function getInstance() { if ( ! ( self::$_instance instanceof self ) ) { self::$_instance = new self(); } return self::$_instance; } /** * Defines Ivory Search Constants. */ private function define_constants() { define( 'IS_VERSION', '4.0' ); define( 'IS_PLUGIN_DIR', plugin_dir_path( __FILE__ ) ); define( 'IS_PLUGIN_FILE', __FILE__ ); if ( ! defined( 'IS_ADMIN_READ_CAPABILITY' ) ) { define( 'IS_ADMIN_READ_CAPABILITY', 'edit_posts' ); } if ( ! defined( 'IS_ADMIN_READ_WRITE_CAPABILITY' ) ) { define( 'IS_ADMIN_READ_WRITE_CAPABILITY', 'publish_pages' ); } } /** * Includes required core files used in admin and on the frontend. */ public function includes() { foreach( glob( IS_PLUGIN_DIR.'includes/' . "*.php" ) as $file ) { require_once $file; } if ( is_admin() ) { foreach( glob( IS_PLUGIN_DIR.'admin/' . "*.php" ) as $file ) { require_once $file; } } else { foreach( glob( IS_PLUGIN_DIR.'public/' . "*.php" ) as $file ) { require_once $file; } } } /** * Hooks into initialization actions and filters. */ private function init_hooks() { // Executes necessary actions on plugin activation and deactivation. register_activation_hook( IS_PLUGIN_FILE, array( 'IS_Activator', 'activate' ) ); register_deactivation_hook( IS_PLUGIN_FILE, array( 'IS_Deactivator', 'deactivate' ) ); } /** * Starts plugin execution. */ function start() { $is_loader = IS_Loader::getInstance( $this->opt ); $is_loader->load(); } } /** * Starts plugin execution. */ $is = Ivory_Search::getInstance(); $is->start();