store = new Akintu_Connection_Store(); } /** * Register WordPress hooks. * * @return void */ public function register() { $api = new Akintu_Api_Client(); $admin = new Akintu_Admin( $this->store, $api ); $admin->register(); $admin_api = new Akintu_Admin_Api( $this->store, $api ); $admin_api->register(); add_action( 'init', array( $this, 'register_content_integrations' ) ); add_action( 'wp_head', array( $this, 'render_verification_marker' ), 1 ); add_action( 'wp_footer', array( $this, 'enqueue_runtime' ), 1 ); add_filter( 'wp_script_attributes', array( $this, 'add_runtime_credentials' ) ); add_action( 'plugins_loaded', array( $this, 'register_elementor' ), 20 ); } /** * Register Elementor whether it loaded before or after Akintu. * * @return void */ public function register_elementor() { if ( did_action( 'elementor/loaded' ) ) { Akintu_Elementor::register(); return; } add_action( 'elementor/loaded', array( 'Akintu_Elementor', 'register' ) ); } /** * Set the activation redirect only for interactive single-site activation. * * @return void */ public static function activate() { add_option( 'akintu_activation_redirect', '1', '', false ); } /** * Register the shortcode and dynamic block. * * @return void */ public function register_content_integrations() { add_shortcode( 'akintu_embed', array( $this, 'render_embed_shortcode' ) ); register_block_type( AKINTU_PLUGIN_DIR . 'blocks/embed', array( 'render_callback' => array( $this, 'render_embed_block' ) ) ); } /** * Render Embed from a shortcode. * * @return string */ public function render_embed_shortcode() { return $this->get_embed_markup(); } /** * Render the dynamic Embed block. * * @return string */ public function render_embed_block() { return $this->get_embed_markup(); } /** * Return canonical Embed markup and request its runtime. * * @return string */ public function get_embed_markup() { $this->should_enqueue = true; if ( ! $this->store->is_connected() ) { return current_user_can( 'edit_posts' ) ? '
' : ''; } return '