rules = new AIparently_Rule_Engine(); $this->classification = new AIparently_Classification_Service( $this->rules ); $this->image_renderer = new AIparently_Image_Label_Renderer( $this->classification ); $this->elementor_adapter = new AIparently_Elementor_Adapter( $this->image_renderer ); $this->disclosure = new AIparently_Disclosure_Service( $this->classification, $this->image_renderer ); $this->rest = new AIparently_REST_Controller( $this->classification ); add_action( 'init', array( $this, 'register_meta' ) ); add_action( 'rest_api_init', array( $this->rest, 'register_routes' ) ); $this->disclosure->register_hooks(); $this->elementor_adapter->register_hooks(); if ( is_admin() ) { $this->admin = new AIparently_Admin( $this->classification ); $this->admin->register_hooks(); } } public function register_meta() { foreach ( AIparently_Classification_Service::SUPPORTED_POST_TYPES as $post_type ) { register_post_meta( $post_type, AIparently_Classification_Service::META_KEY, array( 'type' => 'string', 'single' => true, 'show_in_rest' => true, 'sanitize_callback' => array( 'AIparently_Classification_Service', 'sanitize_status' ), 'auth_callback' => static function ( $allowed, $meta_key, $post_id ) { return current_user_can( 'edit_post', $post_id ); }, ) ); } } public function classification() { return $this->classification; } public function rules() { return $this->rules; } }